@autorest/powershell 2.1.401 → 3.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 +213 -186
- package/.rush/temp/shrinkwrap-deps.json +322 -326
- package/autorest-configuration.md +60 -47
- package/dist/cmdlets/class.d.ts +21 -8
- package/dist/cmdlets/class.d.ts.map +1 -1
- package/dist/cmdlets/class.js +475 -151
- package/dist/cmdlets/class.js.map +1 -1
- package/dist/cmdlets/namespace.d.ts.map +1 -1
- package/dist/cmdlets/namespace.js +1 -0
- package/dist/cmdlets/namespace.js.map +1 -1
- package/dist/enums/namespace.d.ts.map +1 -1
- package/dist/enums/namespace.js +17 -10
- package/dist/enums/namespace.js.map +1 -1
- package/dist/generators/csproj.d.ts.map +1 -1
- package/dist/generators/csproj.js +2 -1
- package/dist/generators/csproj.js.map +1 -1
- package/dist/generators/gitignore.d.ts.map +1 -1
- package/dist/generators/gitignore.js +1 -0
- package/dist/generators/gitignore.js.map +1 -1
- package/dist/generators/nuspec.d.ts.map +1 -1
- package/dist/generators/nuspec.js +4 -3
- package/dist/generators/nuspec.js.map +1 -1
- package/dist/generators/psm1.d.ts.map +1 -1
- package/dist/generators/psm1.js +24 -15
- package/dist/generators/psm1.js.map +1 -1
- package/dist/generators/script-cmdlet.d.ts.map +1 -1
- package/dist/generators/script-cmdlet.js +1 -1
- package/dist/generators/script-cmdlet.js.map +1 -1
- package/dist/internal/name-inferrer.d.ts.map +1 -1
- package/dist/internal/name-inferrer.js +2 -0
- package/dist/internal/name-inferrer.js.map +1 -1
- package/dist/internal/project.d.ts +46 -5
- package/dist/internal/project.d.ts.map +1 -1
- package/dist/internal/project.js +72 -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 +3 -3
- package/dist/internal/state.js.map +1 -1
- package/dist/llcsharp/clientruntime.d.ts +5 -0
- package/dist/llcsharp/clientruntime.d.ts.map +1 -1
- package/dist/llcsharp/clientruntime.js +5 -0
- package/dist/llcsharp/clientruntime.js.map +1 -1
- package/dist/llcsharp/enums/enum.d.ts +2 -2
- package/dist/llcsharp/enums/enum.d.ts.map +1 -1
- package/dist/llcsharp/enums/enum.js +11 -10
- package/dist/llcsharp/enums/enum.js.map +1 -1
- package/dist/llcsharp/generator.d.ts +3 -3
- package/dist/llcsharp/generator.d.ts.map +1 -1
- package/dist/llcsharp/generator.js +4 -2
- package/dist/llcsharp/generator.js.map +1 -1
- package/dist/llcsharp/model/interface.d.ts +3 -2
- package/dist/llcsharp/model/interface.d.ts.map +1 -1
- package/dist/llcsharp/model/interface.js +68 -17
- package/dist/llcsharp/model/interface.js.map +1 -1
- package/dist/llcsharp/model/model-class-dictionary.d.ts.map +1 -1
- package/dist/llcsharp/model/model-class-dictionary.js +12 -6
- package/dist/llcsharp/model/model-class-dictionary.js.map +1 -1
- package/dist/llcsharp/model/model-class-json.d.ts.map +1 -1
- package/dist/llcsharp/model/model-class-json.js +20 -12
- package/dist/llcsharp/model/model-class-json.js.map +1 -1
- package/dist/llcsharp/model/model-class-serializer.d.ts +9 -21
- package/dist/llcsharp/model/model-class-serializer.d.ts.map +1 -1
- package/dist/llcsharp/model/model-class-serializer.js +21 -50
- package/dist/llcsharp/model/model-class-serializer.js.map +1 -1
- package/dist/llcsharp/model/model-class.d.ts +7 -4
- package/dist/llcsharp/model/model-class.d.ts.map +1 -1
- package/dist/llcsharp/model/model-class.js +147 -82
- package/dist/llcsharp/model/model-class.js.map +1 -1
- package/dist/llcsharp/model/namespace.d.ts +4 -4
- package/dist/llcsharp/model/namespace.d.ts.map +1 -1
- package/dist/llcsharp/model/namespace.js +40 -18
- package/dist/llcsharp/model/namespace.js.map +1 -1
- package/dist/llcsharp/model/property.d.ts +4 -4
- package/dist/llcsharp/model/property.d.ts.map +1 -1
- package/dist/llcsharp/model/property.js +9 -7
- 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 +24 -23
- package/dist/llcsharp/operation/api-class.js.map +1 -1
- package/dist/llcsharp/operation/method.d.ts +7 -5
- package/dist/llcsharp/operation/method.d.ts.map +1 -1
- package/dist/llcsharp/operation/method.js +157 -93
- package/dist/llcsharp/operation/method.js.map +1 -1
- package/dist/llcsharp/operation/namespace.js +2 -1
- package/dist/llcsharp/operation/namespace.js.map +1 -1
- package/dist/llcsharp/operation/parameter.d.ts +4 -4
- package/dist/llcsharp/operation/parameter.d.ts.map +1 -1
- package/dist/llcsharp/operation/parameter.js +7 -5
- package/dist/llcsharp/operation/parameter.js.map +1 -1
- package/dist/llcsharp/project.d.ts +4 -0
- package/dist/llcsharp/project.d.ts.map +1 -1
- package/dist/llcsharp/project.js +7 -2
- package/dist/llcsharp/project.js.map +1 -1
- package/dist/llcsharp/schema/Uuid.d.ts +2 -2
- package/dist/llcsharp/schema/Uuid.d.ts.map +1 -1
- package/dist/llcsharp/schema/Uuid.js.map +1 -1
- package/dist/llcsharp/schema/array.d.ts +3 -3
- package/dist/llcsharp/schema/array.d.ts.map +1 -1
- package/dist/llcsharp/schema/array.js +15 -8
- package/dist/llcsharp/schema/array.js.map +1 -1
- package/dist/llcsharp/schema/binary.d.ts +3 -3
- package/dist/llcsharp/schema/binary.d.ts.map +1 -1
- package/dist/llcsharp/schema/binary.js.map +1 -1
- package/dist/llcsharp/schema/boolean.d.ts +4 -4
- package/dist/llcsharp/schema/boolean.d.ts.map +1 -1
- package/dist/llcsharp/schema/boolean.js +1 -1
- package/dist/llcsharp/schema/boolean.js.map +1 -1
- package/dist/llcsharp/schema/byte-array.d.ts +3 -3
- package/dist/llcsharp/schema/byte-array.d.ts.map +1 -1
- package/dist/llcsharp/schema/byte-array.js +12 -2
- package/dist/llcsharp/schema/byte-array.js.map +1 -1
- package/dist/llcsharp/schema/char.d.ts +4 -4
- package/dist/llcsharp/schema/char.d.ts.map +1 -1
- package/dist/llcsharp/schema/char.js +3 -3
- package/dist/llcsharp/schema/char.js.map +1 -1
- package/dist/llcsharp/schema/date-time.d.ts +7 -7
- package/dist/llcsharp/schema/date-time.d.ts.map +1 -1
- package/dist/llcsharp/schema/date-time.js +4 -4
- package/dist/llcsharp/schema/date-time.js.map +1 -1
- package/dist/llcsharp/schema/date.d.ts +2 -2
- package/dist/llcsharp/schema/date.d.ts.map +1 -1
- package/dist/llcsharp/schema/date.js.map +1 -1
- package/dist/llcsharp/schema/duration.d.ts +5 -5
- package/dist/llcsharp/schema/duration.d.ts.map +1 -1
- package/dist/llcsharp/schema/duration.js +2 -2
- package/dist/llcsharp/schema/duration.js.map +1 -1
- package/dist/llcsharp/schema/enum.d.ts +2 -2
- package/dist/llcsharp/schema/enum.d.ts.map +1 -1
- package/dist/llcsharp/schema/enum.js +5 -3
- package/dist/llcsharp/schema/enum.js.map +1 -1
- package/dist/llcsharp/schema/extended-type-declaration.d.ts +2 -2
- package/dist/llcsharp/schema/extended-type-declaration.d.ts.map +1 -1
- package/dist/llcsharp/schema/integer.d.ts +4 -4
- package/dist/llcsharp/schema/integer.d.ts.map +1 -1
- package/dist/llcsharp/schema/integer.js +1 -1
- package/dist/llcsharp/schema/integer.js.map +1 -1
- package/dist/llcsharp/schema/object.d.ts +3 -3
- package/dist/llcsharp/schema/object.d.ts.map +1 -1
- package/dist/llcsharp/schema/object.js +25 -21
- package/dist/llcsharp/schema/object.js.map +1 -1
- package/dist/llcsharp/schema/password.d.ts +23 -0
- package/dist/llcsharp/schema/password.d.ts.map +1 -0
- package/dist/llcsharp/schema/password.js +89 -0
- package/dist/llcsharp/schema/password.js.map +1 -0
- package/dist/llcsharp/schema/primitive.d.ts +4 -4
- package/dist/llcsharp/schema/primitive.d.ts.map +1 -1
- package/dist/llcsharp/schema/primitive.js +7 -3
- package/dist/llcsharp/schema/primitive.js.map +1 -1
- package/dist/llcsharp/schema/schema-resolver.d.ts +4 -3
- package/dist/llcsharp/schema/schema-resolver.d.ts.map +1 -1
- package/dist/llcsharp/schema/schema-resolver.js +61 -64
- package/dist/llcsharp/schema/schema-resolver.js.map +1 -1
- package/dist/llcsharp/schema/string.d.ts +3 -3
- package/dist/llcsharp/schema/string.d.ts.map +1 -1
- package/dist/llcsharp/schema/string.js +14 -10
- package/dist/llcsharp/schema/string.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +23 -14
- package/dist/main.js.map +1 -1
- package/dist/models/model-extensions.d.ts +3 -2
- package/dist/models/model-extensions.d.ts.map +1 -1
- package/dist/models/model-extensions.js +195 -168
- package/dist/models/model-extensions.js.map +1 -1
- package/dist/module/module-class.d.ts +4 -2
- package/dist/module/module-class.d.ts.map +1 -1
- package/dist/module/module-class.js +67 -13
- package/dist/module/module-class.js.map +1 -1
- package/dist/module/module-namespace.d.ts +2 -2
- package/dist/module/module-namespace.d.ts.map +1 -1
- package/dist/module/module-namespace.js +3 -2
- package/dist/module/module-namespace.js.map +1 -1
- package/dist/plugins/add-azure-completers-v2.d.ts +3 -0
- package/dist/plugins/add-azure-completers-v2.d.ts.map +1 -0
- package/dist/plugins/{add-azure-completers.js → add-azure-completers-v2.js} +7 -5
- package/dist/plugins/add-azure-completers-v2.js.map +1 -0
- package/dist/plugins/create-commands-v2.d.ts +40 -0
- package/dist/plugins/create-commands-v2.d.ts.map +1 -0
- package/dist/plugins/{create-commands.js → create-commands-v2.js} +128 -78
- package/dist/plugins/create-commands-v2.js.map +1 -0
- package/dist/plugins/cs-namer-v2.d.ts +3 -0
- package/dist/plugins/cs-namer-v2.d.ts.map +1 -0
- package/dist/plugins/cs-namer-v2.js +230 -0
- package/dist/plugins/cs-namer-v2.js.map +1 -0
- package/dist/plugins/llcsharp-v2.d.ts +3 -0
- package/dist/plugins/llcsharp-v2.d.ts.map +1 -0
- package/dist/plugins/{llcsharp.js → llcsharp-v2.js} +3 -3
- package/dist/plugins/llcsharp-v2.js.map +1 -0
- package/dist/plugins/modifiers-v2.d.ts +3 -0
- package/dist/plugins/modifiers-v2.d.ts.map +1 -0
- package/dist/plugins/{modifiers.js → modifiers-v2.js} +151 -32
- package/dist/plugins/modifiers-v2.js.map +1 -0
- package/dist/plugins/plugin-create-inline-properties.d.ts +4 -0
- package/dist/plugins/plugin-create-inline-properties.d.ts.map +1 -0
- package/dist/plugins/plugin-create-inline-properties.js +356 -0
- package/dist/plugins/plugin-create-inline-properties.js.map +1 -0
- package/dist/plugins/plugin-tweak-m4-model.d.ts +3 -0
- package/dist/plugins/plugin-tweak-m4-model.d.ts.map +1 -0
- package/dist/plugins/plugin-tweak-m4-model.js +166 -0
- package/dist/plugins/plugin-tweak-m4-model.js.map +1 -0
- package/dist/plugins/plugin-tweak-model-azure-v2.d.ts +3 -0
- package/dist/plugins/plugin-tweak-model-azure-v2.d.ts.map +1 -0
- package/dist/plugins/plugin-tweak-model-azure-v2.js +169 -0
- package/dist/plugins/plugin-tweak-model-azure-v2.js.map +1 -0
- package/dist/plugins/plugin-tweak-model.d.ts +9 -0
- package/dist/plugins/plugin-tweak-model.d.ts.map +1 -0
- package/dist/plugins/plugin-tweak-model.js +572 -0
- package/dist/plugins/plugin-tweak-model.js.map +1 -0
- package/dist/plugins/powershell-v2.d.ts +3 -0
- package/dist/plugins/powershell-v2.d.ts.map +1 -0
- package/dist/plugins/{powershell.js → powershell-v2.js} +9 -4
- package/dist/plugins/powershell-v2.js.map +1 -0
- package/dist/plugins/{ps-namer.d.ts → ps-namer-v2.d.ts} +2 -2
- package/dist/plugins/ps-namer-v2.d.ts.map +1 -0
- package/dist/plugins/{ps-namer.js → ps-namer-v2.js} +64 -49
- package/dist/plugins/ps-namer-v2.js.map +1 -0
- package/dist/utils/PwshModel.d.ts +8 -0
- package/dist/utils/PwshModel.d.ts.map +1 -0
- package/dist/utils/PwshModel.js +17 -0
- package/dist/utils/PwshModel.js.map +1 -0
- package/dist/utils/command-operation.d.ts +51 -0
- package/dist/utils/command-operation.d.ts.map +1 -0
- package/dist/utils/command-operation.js +33 -0
- package/dist/utils/command-operation.js.map +1 -0
- package/dist/utils/components.d.ts +133 -0
- package/dist/utils/components.d.ts.map +1 -0
- package/dist/utils/components.js +100 -0
- package/dist/utils/components.js.map +1 -0
- package/dist/utils/extensions.d.ts +11 -0
- package/dist/utils/extensions.d.ts.map +1 -0
- package/dist/utils/extensions.js +16 -0
- package/dist/utils/extensions.js.map +1 -0
- package/dist/utils/http-definitions.d.ts +45 -0
- package/dist/utils/http-definitions.d.ts.map +1 -0
- package/dist/utils/http-definitions.js +47 -0
- package/dist/utils/http-definitions.js.map +1 -0
- package/dist/utils/http-operation.d.ts +8 -0
- package/dist/utils/http-operation.d.ts.map +1 -0
- package/dist/utils/http-operation.js +254 -0
- package/dist/utils/http-operation.js.map +1 -0
- package/dist/utils/info.d.ts +36 -0
- package/dist/utils/info.d.ts.map +1 -0
- package/dist/utils/info.js +36 -0
- package/dist/utils/info.js.map +1 -0
- package/dist/utils/model-state.d.ts +44 -0
- package/dist/utils/model-state.d.ts.map +1 -0
- package/dist/utils/model-state.js +206 -0
- package/dist/utils/model-state.js.map +1 -0
- package/dist/utils/powershell-comment.d.ts +2 -0
- package/dist/utils/powershell-comment.d.ts.map +1 -0
- package/dist/utils/powershell-comment.js +25 -0
- package/dist/utils/powershell-comment.js.map +1 -0
- package/dist/utils/programatic-operation.d.ts +20 -0
- package/dist/utils/programatic-operation.d.ts.map +1 -0
- package/dist/utils/programatic-operation.js +29 -0
- package/dist/utils/programatic-operation.js.map +1 -0
- package/dist/utils/resolve-conflicts.d.ts +7 -0
- package/dist/utils/resolve-conflicts.d.ts.map +1 -0
- package/dist/utils/resolve-conflicts.js +57 -0
- package/dist/utils/resolve-conflicts.js.map +1 -0
- package/dist/utils/schema.d.ts +116 -0
- package/dist/utils/schema.d.ts.map +1 -0
- package/dist/utils/schema.js +186 -0
- package/dist/utils/schema.js.map +1 -0
- package/dist/utils/security-scheme.d.ts +123 -0
- package/dist/utils/security-scheme.d.ts.map +1 -0
- package/dist/utils/security-scheme.js +119 -0
- package/dist/utils/security-scheme.js.map +1 -0
- package/dist/utils/uid.d.ts +2 -0
- package/dist/utils/uid.d.ts.map +1 -0
- package/dist/utils/uid.js +8 -0
- package/dist/utils/uid.js.map +1 -0
- package/package.json +22 -21
- package/resources/assets/build-module.ps1 +12 -15
- package/resources/assets/check-dependencies.ps1 +4 -14
- package/resources/assets/create-model-cmdlets.ps1 +157 -0
- package/resources/assets/custom/{readme.md → README.md} +7 -7
- package/resources/assets/docs/README.md +11 -0
- package/resources/assets/examples/{readme.md → README.md} +0 -0
- package/resources/assets/export-surface.ps1 +1 -11
- package/resources/assets/exports/{readme.md → README.md} +2 -2
- package/resources/assets/generate-help.ps1 +2 -12
- package/resources/assets/how-to.md +5 -5
- package/resources/assets/internal/{readme.md → README.md} +3 -3
- package/resources/assets/pack-module.ps1 +1 -11
- package/resources/assets/resources/{readme.md → README.md} +0 -0
- package/resources/assets/run-module.ps1 +3 -11
- package/resources/assets/test/{readme.md → README.md} +0 -0
- package/resources/assets/test/loadEnv.ps1 +1 -11
- package/resources/assets/test-module.ps1 +39 -24
- package/resources/assets/tools/Resources/{readme.md → README.md} +3 -2
- package/resources/assets/tools/Resources/docs/{readme.md → README.md} +1 -1
- package/resources/assets/tools/Resources/examples/{readme.md → README.md} +0 -0
- package/resources/assets/tools/Resources/how-to.md +5 -5
- package/resources/assets/tools/Resources/resources/{readme.md → README.md} +0 -0
- package/resources/assets/tools/Resources/test/{readme.md → README.md} +0 -0
- package/resources/modules/Az.Accounts/2.7.5/Accounts.format.ps1xml +496 -0
- package/resources/modules/Az.Accounts/2.7.5/Accounts.generated.format.ps1xml +468 -0
- package/resources/modules/Az.Accounts/2.7.5/Accounts.types.ps1xml +303 -0
- package/resources/modules/Az.Accounts/{1.8.1 → 2.7.5}/Az.Accounts.nuspec +5 -3
- package/resources/modules/Az.Accounts/2.7.5/Az.Accounts.psd1 +387 -0
- package/resources/modules/Az.Accounts/2.7.5/Az.Accounts.psm1 +375 -0
- 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/{1.8.1/PreloadAssemblies → 2.7.5/AzSharedAlcAssemblies}/Microsoft.Bcl.AsyncInterfaces.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/AzSharedAlcAssemblies/System.Memory.Data.dll +0 -0
- package/resources/modules/Az.Accounts/2.7.5/AzSharedAlcAssemblies/System.Text.Json.dll +0 -0
- package/resources/modules/Az.Accounts/{1.8.1 → 2.7.5}/Hyak.Common.dll +0 -0
- package/resources/modules/Az.Accounts/2.7.5/Microsoft.ApplicationInsights.dll +0 -0
- package/resources/modules/Az.Accounts/{1.8.1 → 2.7.5}/Microsoft.Azure.Common.dll +0 -0
- package/resources/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Authentication.Abstractions.dll +0 -0
- package/resources/modules/Az.Accounts/{1.8.1 → 2.7.5}/Microsoft.Azure.PowerShell.Authentication.ResourceManager.deps.json +945 -404
- package/resources/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Authentication.ResourceManager.dll +0 -0
- package/resources/modules/Az.Accounts/{1.8.1/Microsoft.Azure.PowerShell.Cmdlets.Accounts.deps.json → 2.7.5/Microsoft.Azure.PowerShell.Authentication.deps.json} +906 -488
- package/resources/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Authentication.dll +0 -0
- package/resources/modules/Az.Accounts/{1.8.1/Microsoft.Azure.PowerShell.Authentication.deps.json → 2.7.5/Microsoft.Azure.PowerShell.AuthenticationAssemblyLoadContext.deps.json} +301 -719
- 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/{1.8.1 → 2.7.5}/Microsoft.Azure.PowerShell.Clients.Aks.dll +0 -0
- package/resources/modules/Az.Accounts/{1.8.1 → 2.7.5}/Microsoft.Azure.PowerShell.Clients.Authorization.dll +0 -0
- package/resources/modules/Az.Accounts/{1.8.1 → 2.7.5}/Microsoft.Azure.PowerShell.Clients.Compute.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/{1.8.1 → 2.7.5}/Microsoft.Azure.PowerShell.Clients.KeyVault.dll +0 -0
- package/resources/modules/Az.Accounts/{1.8.1 → 2.7.5}/Microsoft.Azure.PowerShell.Clients.Monitor.dll +0 -0
- package/resources/modules/Az.Accounts/{1.8.1 → 2.7.5}/Microsoft.Azure.PowerShell.Clients.Network.dll +0 -0
- package/resources/modules/Az.Accounts/{1.8.1 → 2.7.5}/Microsoft.Azure.PowerShell.Clients.PolicyInsights.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.Clients.Storage.Management.dll +0 -0
- package/resources/modules/Az.Accounts/{1.8.1 → 2.7.5}/Microsoft.Azure.PowerShell.Clients.Websites.dll +0 -0
- package/resources/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Cmdlets.Accounts.deps.json +2413 -0
- package/resources/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Cmdlets.Accounts.dll +0 -0
- package/resources/modules/Az.Accounts/{1.8.1 → 2.7.5}/Microsoft.Azure.PowerShell.Cmdlets.Accounts.dll-Help.xml +3567 -1995
- 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/{1.8.1 → 2.7.5}/Microsoft.Azure.PowerShell.Storage.dll +0 -0
- package/resources/modules/Az.Accounts/{1.8.1 → 2.7.5}/Microsoft.Azure.PowerShell.Strategies.dll +0 -0
- package/resources/modules/Az.Accounts/{1.8.1 → 2.7.5}/Microsoft.Rest.ClientRuntime.Azure.dll +0 -0
- package/resources/modules/Az.Accounts/2.7.5/Microsoft.Rest.ClientRuntime.dll +0 -0
- package/resources/modules/Az.Accounts/{1.8.1 → 2.7.5}/Microsoft.WindowsAzure.Storage.DataMovement.dll +0 -0
- package/resources/modules/Az.Accounts/{1.8.1 → 2.7.5}/Microsoft.WindowsAzure.Storage.dll +0 -0
- package/resources/modules/Az.Accounts/2.7.5/PostImportScripts/LoadAuthenticators.ps1 +219 -0
- 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/{1.8.1/PreloadAssemblies/Newtonsoft.Json.10.dll → 2.7.5/PreloadAssemblies/Newtonsoft.Json.dll} +0 -0
- package/resources/modules/Az.Accounts/2.7.5/PreloadAssemblies/System.Buffers.dll +0 -0
- package/resources/modules/Az.Accounts/{1.8.1/PreloadAssemblies/System.Diagnostics.DiagnosticSource.4.0.4.0.dll → 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/{1.8.1 → 2.7.5}/PreloadAssemblies/System.Memory.dll +0 -0
- package/resources/modules/Az.Accounts/{1.8.1 → 2.7.5}/PreloadAssemblies/System.Net.Http.WinHttpHandler.dll +0 -0
- package/resources/modules/Az.Accounts/2.7.5/PreloadAssemblies/System.Numerics.Vectors.dll +0 -0
- package/resources/modules/Az.Accounts/2.7.5/PreloadAssemblies/System.Private.ServiceModel.dll +0 -0
- package/resources/modules/Az.Accounts/{1.8.1 → 2.7.5}/PreloadAssemblies/System.Reflection.DispatchProxy.dll +0 -0
- package/resources/modules/Az.Accounts/{1.8.1/PreloadAssemblies/System.Runtime.CompilerServices.Unsafe.4.0.5.0.dll → 2.7.5/PreloadAssemblies/System.Runtime.CompilerServices.Unsafe.dll} +0 -0
- package/resources/modules/Az.Accounts/{1.8.1 → 2.7.5}/PreloadAssemblies/System.Security.AccessControl.dll +0 -0
- package/resources/modules/Az.Accounts/2.7.5/PreloadAssemblies/System.Security.Cryptography.Cng.dll +0 -0
- package/resources/modules/Az.Accounts/{1.8.1 → 2.7.5}/PreloadAssemblies/System.Security.Permissions.dll +0 -0
- package/resources/modules/Az.Accounts/{1.8.1 → 2.7.5}/PreloadAssemblies/System.Security.Principal.Windows.dll +0 -0
- package/resources/modules/Az.Accounts/2.7.5/PreloadAssemblies/System.ServiceModel.Primitives.dll +0 -0
- package/resources/modules/Az.Accounts/2.7.5/PreloadAssemblies/System.Text.Encodings.Web.dll +0 -0
- package/resources/modules/Az.Accounts/2.7.5/PreloadAssemblies/System.Text.Json.dll +0 -0
- package/resources/modules/Az.Accounts/{1.8.1/PreloadAssemblies/System.Threading.Tasks.Extensions.4.2.0.0.dll → 2.7.5/PreloadAssemblies/System.Threading.Tasks.Extensions.dll} +0 -0
- package/resources/modules/Az.Accounts/{1.8.1 → 2.7.5}/PreloadAssemblies/System.Xml.ReaderWriter.dll +0 -0
- package/resources/modules/Az.Accounts/2.7.5/StartupScripts/AzError.ps1 +278 -0
- package/resources/modules/Az.Accounts/2.7.5/StartupScripts/InitializeAssemblyResolver.ps1 +234 -0
- package/resources/modules/Az.Accounts/{1.8.1 → 2.7.5}/[Content_Types].xml +1 -0
- package/resources/modules/Az.Accounts/{1.8.1 → 2.7.5}/_rels/.rels +2 -2
- package/resources/modules/Az.Accounts/2.7.5/en-US/about_az.help.txt +50 -0
- package/resources/modules/Az.Accounts/{1.8.1/package/services/metadata/core-properties/b4e383786e734eb49545960a9feff173.psmdcp → 2.7.5/package/services/metadata/core-properties/1aa0749a068a4238881858013f1a5b7f.psmdcp} +2 -2
- package/resources/psruntime/AsyncCommandRuntime.cs +4 -0
- package/resources/psruntime/AsyncOperationResponse.cs +10 -11
- package/resources/psruntime/BuildTime/Cmdlets/ExportFormatPs1xml.cs +3 -1
- package/resources/psruntime/BuildTime/Cmdlets/ExportProxyCmdlet.cs +94 -87
- package/resources/psruntime/BuildTime/Cmdlets/ExportPsd1.cs +168 -102
- package/resources/psruntime/BuildTime/Cmdlets/ExportTestStub.cs +22 -11
- package/resources/psruntime/BuildTime/Cmdlets/GetScriptCmdlet.cs +2 -1
- package/resources/psruntime/BuildTime/MarkdownRenderer.cs +1 -8
- package/resources/psruntime/BuildTime/Models/PsHelpMarkdownOutputs.cs +33 -11
- package/resources/psruntime/BuildTime/Models/PsHelpTypes.cs +3 -0
- package/resources/psruntime/BuildTime/Models/PsMarkdownTypes.cs +17 -14
- package/resources/psruntime/BuildTime/Models/PsProxyOutputs.cs +111 -13
- package/resources/psruntime/BuildTime/Models/PsProxyTypes.cs +18 -3
- package/resources/psruntime/BuildTime/PsAttributes.cs +1 -1
- package/resources/psruntime/BuildTime/PsExtensions.cs +9 -0
- package/resources/psruntime/BuildTime/PsHelpers.cs +2 -1
- package/resources/psruntime/DictionaryExtensions.cs +8 -11
- package/resources/psruntime/EventDataExtensions.cs +1 -1
- package/resources/psruntime/MessageAttribute.cs +360 -0
- package/resources/psruntime/MessageAttributeHelper.cs +161 -0
- package/resources/psruntime/Properties/Resources.Designer.cs +5633 -0
- package/resources/psruntime/Properties/Resources.resx +1741 -0
- package/resources/psruntime/TypeConverterExtensions.cs +31 -10
- package/resources/runtime/csharp/client/Extensions.cs +7 -1
- package/resources/runtime/csharp/client/IAssociativeArray.cs +4 -1
- package/resources/runtime/csharp/client/UndeclaredResponseException.cs +10 -2
- package/resources/runtime/csharp/json/Customizations/IJsonSerializable.cs +21 -7
- package/resources/runtime/csharp/json/Nodes/JsonNumber.cs +5 -5
- package/resources/runtime/csharp/pipeline/ISendAsync.cs +7 -3
- package/resources/runtime/csharp/pipeline/PipelineMocking.cs +17 -9
- package/resources/utils/Unprotect-SecureString.ps1 +16 -0
- package/changelog.md +0 -4
- package/dist/llcsharp/enums/json-serializer.d.ts +0 -9
- package/dist/llcsharp/enums/json-serializer.d.ts.map +0 -1
- package/dist/llcsharp/enums/json-serializer.js +0 -41
- package/dist/llcsharp/enums/json-serializer.js.map +0 -1
- package/dist/llcsharp/model/model-class-xml.d.ts +0 -15
- package/dist/llcsharp/model/model-class-xml.d.ts.map +0 -1
- package/dist/llcsharp/model/model-class-xml.js +0 -145
- package/dist/llcsharp/model/model-class-xml.js.map +0 -1
- package/dist/plugins/add-azure-completers.d.ts +0 -3
- package/dist/plugins/add-azure-completers.d.ts.map +0 -1
- package/dist/plugins/add-azure-completers.js.map +0 -1
- package/dist/plugins/create-commands.d.ts +0 -38
- package/dist/plugins/create-commands.d.ts.map +0 -1
- package/dist/plugins/create-commands.js.map +0 -1
- package/dist/plugins/cs-namer.d.ts +0 -3
- package/dist/plugins/cs-namer.d.ts.map +0 -1
- package/dist/plugins/cs-namer.js +0 -203
- package/dist/plugins/cs-namer.js.map +0 -1
- package/dist/plugins/llcsharp.d.ts +0 -3
- package/dist/plugins/llcsharp.d.ts.map +0 -1
- package/dist/plugins/llcsharp.js.map +0 -1
- package/dist/plugins/modifiers.d.ts +0 -3
- package/dist/plugins/modifiers.d.ts.map +0 -1
- package/dist/plugins/modifiers.js.map +0 -1
- package/dist/plugins/powershell.d.ts +0 -3
- package/dist/plugins/powershell.d.ts.map +0 -1
- package/dist/plugins/powershell.js.map +0 -1
- package/dist/plugins/ps-namer.d.ts.map +0 -1
- package/dist/plugins/ps-namer.js.map +0 -1
- package/resources/assets/docs/readme.md +0 -11
- package/resources/modules/Az.Accounts/1.8.1/Accounts.format.ps1xml +0 -368
- package/resources/modules/Az.Accounts/1.8.1/Accounts.generated.format.ps1xml +0 -422
- package/resources/modules/Az.Accounts/1.8.1/Accounts.types.ps1xml +0 -281
- package/resources/modules/Az.Accounts/1.8.1/Az.Accounts.psd1 +0 -360
- package/resources/modules/Az.Accounts/1.8.1/Az.Accounts.psm1 +0 -339
- package/resources/modules/Az.Accounts/1.8.1/Microsoft.ApplicationInsights.dll +0 -0
- package/resources/modules/Az.Accounts/1.8.1/Microsoft.Azure.PowerShell.Authentication.Abstractions.dll +0 -0
- package/resources/modules/Az.Accounts/1.8.1/Microsoft.Azure.PowerShell.Authentication.ResourceManager.dll +0 -0
- package/resources/modules/Az.Accounts/1.8.1/Microsoft.Azure.PowerShell.Authentication.dll +0 -0
- package/resources/modules/Az.Accounts/1.8.1/Microsoft.Azure.PowerShell.Clients.Graph.Rbac.dll +0 -0
- package/resources/modules/Az.Accounts/1.8.1/Microsoft.Azure.PowerShell.Clients.ResourceManager.dll +0 -0
- package/resources/modules/Az.Accounts/1.8.1/Microsoft.Azure.PowerShell.Clients.Storage.Management.dll +0 -0
- package/resources/modules/Az.Accounts/1.8.1/Microsoft.Azure.PowerShell.Cmdlets.Accounts.dll +0 -0
- package/resources/modules/Az.Accounts/1.8.1/Microsoft.Azure.PowerShell.Common.dll +0 -0
- package/resources/modules/Az.Accounts/1.8.1/Microsoft.Rest.ClientRuntime.dll +0 -0
- package/resources/modules/Az.Accounts/1.8.1/NetCoreAssemblies/Azure.Core.dll +0 -0
- package/resources/modules/Az.Accounts/1.8.1/NetCoreAssemblies/Microsoft.Bcl.AsyncInterfaces.dll +0 -0
- package/resources/modules/Az.Accounts/1.8.1/NetCoreAssemblies/Microsoft.IdentityModel.Clients.ActiveDirectory.Platform.dll +0 -0
- package/resources/modules/Az.Accounts/1.8.1/NetCoreAssemblies/Microsoft.IdentityModel.Clients.ActiveDirectory.dll +0 -0
- package/resources/modules/Az.Accounts/1.8.1/NetCoreAssemblies/System.Numerics.Vectors.dll +0 -0
- package/resources/modules/Az.Accounts/1.8.1/NetCoreAssemblies/System.Runtime.CompilerServices.Unsafe.dll +0 -0
- package/resources/modules/Az.Accounts/1.8.1/NetCoreAssemblies/System.Text.Encodings.Web.dll +0 -0
- package/resources/modules/Az.Accounts/1.8.1/NetCoreAssemblies/System.Text.Json.dll +0 -0
- package/resources/modules/Az.Accounts/1.8.1/NetCoreAssemblies/System.Threading.Tasks.Extensions.dll +0 -0
- package/resources/modules/Az.Accounts/1.8.1/PostImportScripts/LoadAuthenticators.ps1 +0 -197
- package/resources/modules/Az.Accounts/1.8.1/PreloadAssemblies/Azure.Core.dll +0 -0
- package/resources/modules/Az.Accounts/1.8.1/PreloadAssemblies/Microsoft.Azure.PowerShell.Authenticators.dll +0 -0
- package/resources/modules/Az.Accounts/1.8.1/PreloadAssemblies/Microsoft.IdentityModel.Clients.ActiveDirectory.Platform.dll +0 -0
- package/resources/modules/Az.Accounts/1.8.1/PreloadAssemblies/Microsoft.IdentityModel.Clients.ActiveDirectory.dll +0 -0
- package/resources/modules/Az.Accounts/1.8.1/PreloadAssemblies/System.Buffers.dll +0 -0
- package/resources/modules/Az.Accounts/1.8.1/PreloadAssemblies/System.Diagnostics.DiagnosticSource.dll +0 -0
- package/resources/modules/Az.Accounts/1.8.1/PreloadAssemblies/System.Numerics.Vectors.dll +0 -0
- package/resources/modules/Az.Accounts/1.8.1/PreloadAssemblies/System.Private.ServiceModel.dll +0 -0
- package/resources/modules/Az.Accounts/1.8.1/PreloadAssemblies/System.Runtime.CompilerServices.Unsafe.4.0.4.0.dll +0 -0
- package/resources/modules/Az.Accounts/1.8.1/PreloadAssemblies/System.Runtime.CompilerServices.Unsafe.4.0.4.1.dll +0 -0
- package/resources/modules/Az.Accounts/1.8.1/PreloadAssemblies/System.ServiceModel.Primitives.dll +0 -0
- package/resources/modules/Az.Accounts/1.8.1/PreloadAssemblies/System.Text.Encodings.Web.dll +0 -0
- package/resources/modules/Az.Accounts/1.8.1/PreloadAssemblies/System.Text.Json.dll +0 -0
- package/resources/modules/Az.Accounts/1.8.1/PreloadAssemblies/System.Threading.Tasks.Extensions.4.3.1.0.dll +0 -0
- package/resources/modules/Az.Accounts/1.8.1/StartupScripts/AzError.ps1 +0 -256
|
@@ -0,0 +1,356 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*---------------------------------------------------------------------------------------------
|
|
3
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4
|
+
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
5
|
+
*--------------------------------------------------------------------------------------------*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
const codemodel_1 = require("@azure-tools/codemodel");
|
|
8
|
+
const codegen_1 = require("@azure-tools/codegen");
|
|
9
|
+
const linq_1 = require("@azure-tools/linq");
|
|
10
|
+
const model_state_1 = require("../utils/model-state");
|
|
11
|
+
const schema_1 = require("../utils/schema");
|
|
12
|
+
const resolve_conflicts_1 = require("../utils/resolve-conflicts");
|
|
13
|
+
function getPluralizationService() {
|
|
14
|
+
const result = new codegen_1.EnglishPluralizationService();
|
|
15
|
+
result.addWord('Database', 'Databases');
|
|
16
|
+
result.addWord('database', 'databases');
|
|
17
|
+
result.addWord('Premise', 'Premises');
|
|
18
|
+
result.addWord('premise', 'premises');
|
|
19
|
+
return result;
|
|
20
|
+
}
|
|
21
|
+
function singularize(word) {
|
|
22
|
+
return getPluralizationService().singularize(word);
|
|
23
|
+
}
|
|
24
|
+
exports.singularize = singularize;
|
|
25
|
+
function getNameOptions(typeName, components) {
|
|
26
|
+
const result = new Set();
|
|
27
|
+
// add a variant for each incrementally inclusive parent naming scheme.
|
|
28
|
+
for (let i = 0; i < linq_1.length(components); i++) {
|
|
29
|
+
const subset = codegen_1.pascalCase([...codegen_1.removeSequentialDuplicates(components.slice(-1 * i, linq_1.length(components)))]);
|
|
30
|
+
result.add(subset);
|
|
31
|
+
}
|
|
32
|
+
// add a second-to-last-ditch option as <typename>.<name>
|
|
33
|
+
result.add(codegen_1.pascalCase([...codegen_1.removeSequentialDuplicates([...codegen_1.fixLeadingNumber(codegen_1.deconstruct(typeName)), ...codegen_1.deconstruct(components.last)])]));
|
|
34
|
+
return [...result.values()];
|
|
35
|
+
}
|
|
36
|
+
function createVirtualProperties(schema, stack, threshold, conflicts) {
|
|
37
|
+
var _a, _b, _c;
|
|
38
|
+
// Some properties should be removed are wrongly kept as null and need to clean them
|
|
39
|
+
if (schema.properties) {
|
|
40
|
+
schema.properties = schema.properties.filter(each => each);
|
|
41
|
+
}
|
|
42
|
+
// dolauli
|
|
43
|
+
// owned: all properties(obj & nonobj) in the schema,
|
|
44
|
+
// inherited: Properties from parents,
|
|
45
|
+
// inlined: for obj properties, flatten them to children,
|
|
46
|
+
// did we already inline this object
|
|
47
|
+
if (schema.language.default.inline === 'yes') {
|
|
48
|
+
return true;
|
|
49
|
+
}
|
|
50
|
+
if (schema.language.default.inline === 'no') {
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
53
|
+
// this is bad. This would happen when we have a circular reference in the tree.
|
|
54
|
+
// dolauli curious in which case this will happen, got it to use no-inline to skip inline and avoid circular reference
|
|
55
|
+
if (schema.language.default.inline === 'inprogress') {
|
|
56
|
+
let text = (`Note: during processing of '${schema.language.default.name}' a circular reference has been discovered.`);
|
|
57
|
+
text += '\n In order to proceed, you must add a directive to indicate which model you want to not inline.\n';
|
|
58
|
+
text += '\ndirective:';
|
|
59
|
+
text += '\n- no-inline: # choose ONE of these models to disable inlining';
|
|
60
|
+
for (const each of stack) {
|
|
61
|
+
text += (`\n - ${each} `);
|
|
62
|
+
}
|
|
63
|
+
text += '\n';
|
|
64
|
+
conflicts.push(text);
|
|
65
|
+
/* `directive:
|
|
66
|
+
- no-inline:
|
|
67
|
+
- MyModel
|
|
68
|
+
- YourModel
|
|
69
|
+
- HerModel
|
|
70
|
+
` */
|
|
71
|
+
// `, and we're skipping inlining.\n ${stack.join(' => ')}`);
|
|
72
|
+
// mark it as 'not-inlining'
|
|
73
|
+
schema.language.default.inline = 'no';
|
|
74
|
+
return false;
|
|
75
|
+
}
|
|
76
|
+
// ok, set to in progress now.
|
|
77
|
+
schema.language.default.inline = 'inprogress';
|
|
78
|
+
// virutual property set.
|
|
79
|
+
const virtualProperties = schema.language.default.virtualProperties = {
|
|
80
|
+
owned: new Array(),
|
|
81
|
+
inherited: new Array(),
|
|
82
|
+
inlined: new Array(),
|
|
83
|
+
};
|
|
84
|
+
// First we should run thru the properties in parent classes and create inliners for each property they have.
|
|
85
|
+
// dolauli handle properties in parents
|
|
86
|
+
for (const parentSchema of linq_1.values((_a = schema.parents) === null || _a === void 0 ? void 0 : _a.immediate)) {
|
|
87
|
+
// make sure that the parent is done.
|
|
88
|
+
// Guess parent should always be an object.
|
|
89
|
+
if (!codemodel_1.isObjectSchema(parentSchema))
|
|
90
|
+
continue;
|
|
91
|
+
createVirtualProperties(parentSchema, [...stack, `${schema.language.default.name}`], threshold, conflicts);
|
|
92
|
+
const parentProperties = parentSchema.language.default.virtualProperties || {
|
|
93
|
+
owned: [],
|
|
94
|
+
inherited: [],
|
|
95
|
+
inlined: [],
|
|
96
|
+
};
|
|
97
|
+
// now we go thru the parent's virutal properties and create our own copies
|
|
98
|
+
for (const virtualProperty of [...parentProperties.inherited, ...parentProperties.inlined, ...parentProperties.owned]) {
|
|
99
|
+
// make sure that we have a list of shared owners of this property.
|
|
100
|
+
virtualProperty.sharedWith = virtualProperty.sharedWith || [virtualProperty];
|
|
101
|
+
// we are just copying over theirs to ours.
|
|
102
|
+
const inheritedProperty = {
|
|
103
|
+
name: virtualProperty.name,
|
|
104
|
+
property: virtualProperty.property,
|
|
105
|
+
private: virtualProperty.private,
|
|
106
|
+
nameComponents: virtualProperty.nameComponents,
|
|
107
|
+
nameOptions: virtualProperty.nameOptions,
|
|
108
|
+
accessViaProperty: virtualProperty,
|
|
109
|
+
accessViaMember: virtualProperty,
|
|
110
|
+
accessViaSchema: parentSchema,
|
|
111
|
+
originalContainingSchema: virtualProperty.originalContainingSchema,
|
|
112
|
+
description: virtualProperty.description,
|
|
113
|
+
alias: [],
|
|
114
|
+
readOnly: virtualProperty.readOnly,
|
|
115
|
+
required: virtualProperty.required,
|
|
116
|
+
sharedWith: virtualProperty.sharedWith,
|
|
117
|
+
};
|
|
118
|
+
// add it to the list of virtual properties that share this property.
|
|
119
|
+
virtualProperty.sharedWith.push(inheritedProperty);
|
|
120
|
+
// add it to this class.
|
|
121
|
+
virtualProperties.inherited.push(inheritedProperty);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
// dolauli figure out object properties and non object properties in this class
|
|
125
|
+
const [objectProperties, nonObjectProperties] = linq_1.values(schema.properties).bifurcate(each => !schema.language.default['skip-inline'] && // if this schema is marked skip-inline, none can be inlined, treat them all as straight properties.
|
|
126
|
+
!each.schema.language.default['skip-inline'] && // if the property schema is marked skip-inline, then it should not be processed either.
|
|
127
|
+
each.schema.type === codemodel_1.SchemaType.Object && // is it an object
|
|
128
|
+
schema_1.getAllProperties(each.schema).length > 0 // does it have properties (or inherit properties)
|
|
129
|
+
);
|
|
130
|
+
// run thru the properties in this class.
|
|
131
|
+
// dolauli handle properties in this class
|
|
132
|
+
for (const property of objectProperties) {
|
|
133
|
+
const propertyName = property.language.default.name;
|
|
134
|
+
// for each object member, make sure that it's inlined it's children that it can.
|
|
135
|
+
createVirtualProperties(property.schema, [...stack, `${schema.language.default.name}`], threshold, conflicts);
|
|
136
|
+
// this happens if there is a circular reference.
|
|
137
|
+
// this means that this class should not attempt any inlining of that property at all .
|
|
138
|
+
// dolauli pay attention to the condition check
|
|
139
|
+
const isDict = property.schema.type === codemodel_1.SchemaType.Dictionary || ((_c = (_b = property.schema.parents) === null || _b === void 0 ? void 0 : _b.immediate) === null || _c === void 0 ? void 0 : _c.find((s) => s.type === codemodel_1.SchemaType.Dictionary));
|
|
140
|
+
const canInline = (!property.schema.language.default['skip-inline']) &&
|
|
141
|
+
(!property.schema.language.default.byReference) &&
|
|
142
|
+
(!isDict) &&
|
|
143
|
+
property.schema.language.default.inline === 'yes';
|
|
144
|
+
// the target has properties that we can inline
|
|
145
|
+
const virtualChildProperties = property.schema.language.default.virtualProperties || {
|
|
146
|
+
owned: [],
|
|
147
|
+
inherited: [],
|
|
148
|
+
inlined: [],
|
|
149
|
+
};
|
|
150
|
+
const allNotRequired = linq_1.values(schema_1.getAllPublicVirtualProperties()).all(each => !each.property.language.default.required);
|
|
151
|
+
const childCount = linq_1.length(virtualChildProperties.owned) + linq_1.length(virtualChildProperties.inherited) + linq_1.length(virtualChildProperties.inlined);
|
|
152
|
+
if (canInline && (property.language.default.required || allNotRequired) && (childCount < threshold || propertyName === 'properties')) {
|
|
153
|
+
// if the child property is low enough (or it's 'properties'), let's create virtual properties for each one.
|
|
154
|
+
// create a private property for the inlined ones to use.
|
|
155
|
+
const privateProperty = {
|
|
156
|
+
name: codegen_1.getPascalIdentifier(propertyName),
|
|
157
|
+
propertySchema: schema,
|
|
158
|
+
property,
|
|
159
|
+
nameComponents: [codegen_1.getPascalIdentifier(propertyName)],
|
|
160
|
+
nameOptions: getNameOptions(schema.language.default.name, [propertyName]),
|
|
161
|
+
private: true,
|
|
162
|
+
description: property.summary || '',
|
|
163
|
+
originalContainingSchema: schema,
|
|
164
|
+
alias: [],
|
|
165
|
+
required: property.required || property.language.default.required,
|
|
166
|
+
};
|
|
167
|
+
virtualProperties.owned.push(privateProperty);
|
|
168
|
+
for (const inlinedProperty of [...virtualChildProperties.inherited, ...virtualChildProperties.owned]) {
|
|
169
|
+
// child properties are be inlined without prefixing the name with the property name
|
|
170
|
+
// unless there is a collision, in which case, we have to resolve
|
|
171
|
+
// (scan back from the far right)
|
|
172
|
+
// deeper child properties should be inlined with their parent's name
|
|
173
|
+
// ie, this.[properties].owner.name should be this.ownerName
|
|
174
|
+
const proposedName = codegen_1.getPascalIdentifier(`${propertyName === 'properties' || /*objectProperties.length === 1*/ propertyName === 'error' ? '' : codegen_1.pascalCase(codegen_1.fixLeadingNumber(codegen_1.deconstruct(propertyName)).map(each => singularize(each)))} ${inlinedProperty.name}`);
|
|
175
|
+
const components = [...codegen_1.removeSequentialDuplicates([propertyName, ...inlinedProperty.nameComponents])];
|
|
176
|
+
virtualProperties.inlined.push({
|
|
177
|
+
name: proposedName,
|
|
178
|
+
property: inlinedProperty.property,
|
|
179
|
+
private: inlinedProperty.private,
|
|
180
|
+
nameComponents: components,
|
|
181
|
+
nameOptions: getNameOptions(inlinedProperty.property.schema.language.default.name, components),
|
|
182
|
+
accessViaProperty: privateProperty,
|
|
183
|
+
accessViaMember: inlinedProperty,
|
|
184
|
+
accessViaSchema: schema,
|
|
185
|
+
originalContainingSchema: schema,
|
|
186
|
+
description: inlinedProperty.description,
|
|
187
|
+
alias: [],
|
|
188
|
+
readOnly: inlinedProperty.readOnly || property.readOnly,
|
|
189
|
+
required: inlinedProperty.required && privateProperty.required,
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
for (const inlinedProperty of [...virtualChildProperties.inlined]) {
|
|
193
|
+
// child properties are be inlined without prefixing the name with the property name
|
|
194
|
+
// unless there is a collision, in which case, we have to resolve
|
|
195
|
+
// (scan back from the far right)
|
|
196
|
+
// deeper child properties should be inlined with their parent's name
|
|
197
|
+
// ie, this.[properties].owner.name should be this.ownerName
|
|
198
|
+
const proposedName = codegen_1.getPascalIdentifier(inlinedProperty.name);
|
|
199
|
+
const components = [...codegen_1.removeSequentialDuplicates([propertyName, ...inlinedProperty.nameComponents])];
|
|
200
|
+
virtualProperties.inlined.push({
|
|
201
|
+
name: proposedName,
|
|
202
|
+
property: inlinedProperty.property,
|
|
203
|
+
private: inlinedProperty.private,
|
|
204
|
+
nameComponents: components,
|
|
205
|
+
nameOptions: getNameOptions(inlinedProperty.property.schema.language.default.name, components),
|
|
206
|
+
accessViaProperty: privateProperty,
|
|
207
|
+
accessViaMember: inlinedProperty,
|
|
208
|
+
accessViaSchema: schema,
|
|
209
|
+
originalContainingSchema: schema,
|
|
210
|
+
description: inlinedProperty.description,
|
|
211
|
+
alias: [],
|
|
212
|
+
readOnly: inlinedProperty.readOnly || property.readOnly,
|
|
213
|
+
required: inlinedProperty.required && privateProperty.required
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
else {
|
|
218
|
+
// otherwise, we're not below the threshold, and we should treat this as a non-inlined property
|
|
219
|
+
nonObjectProperties.push(property);
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
for (const property of nonObjectProperties) {
|
|
223
|
+
const name = codegen_1.getPascalIdentifier(property.language.default.name);
|
|
224
|
+
// this is not something that has properties,
|
|
225
|
+
// so we don't need to do any inlining
|
|
226
|
+
// however, we can add it to our list of virtual properties
|
|
227
|
+
// so that our consumers can get it.
|
|
228
|
+
virtualProperties.owned.push({
|
|
229
|
+
name,
|
|
230
|
+
property,
|
|
231
|
+
nameComponents: [name],
|
|
232
|
+
nameOptions: [name],
|
|
233
|
+
description: property.summary || '',
|
|
234
|
+
originalContainingSchema: schema,
|
|
235
|
+
alias: [],
|
|
236
|
+
readOnly: property.readOnly,
|
|
237
|
+
required: property.required || property.language.default.required
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
// resolve name collisions.
|
|
241
|
+
const allProps = [...virtualProperties.owned, ...virtualProperties.inherited, ...virtualProperties.inlined];
|
|
242
|
+
const inlined = new Map();
|
|
243
|
+
for (const each of allProps) {
|
|
244
|
+
// track number of instances of a given name.
|
|
245
|
+
inlined.set(each.name, (inlined.get(each.name) || 0) + 1);
|
|
246
|
+
}
|
|
247
|
+
const usedNames = new Set(inlined.keys());
|
|
248
|
+
for (const each of virtualProperties.inlined.sort((a, b) => linq_1.length(a.nameOptions) - linq_1.length(b.nameOptions))) {
|
|
249
|
+
const ct = inlined.get(each.name);
|
|
250
|
+
if (ct && ct > 1) {
|
|
251
|
+
// console.error(`Fixing collision on name ${each.name} #${ct} `);
|
|
252
|
+
each.name = codegen_1.selectName(each.nameOptions, usedNames);
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
schema.language.default.inline = 'yes';
|
|
256
|
+
return true;
|
|
257
|
+
}
|
|
258
|
+
function createVirtualParameters(operation) {
|
|
259
|
+
// dolauli expand body parameter
|
|
260
|
+
// for virtual parameters, there are two keys, operation and body
|
|
261
|
+
const virtualParameters = {
|
|
262
|
+
operation: new Array(),
|
|
263
|
+
body: new Array()
|
|
264
|
+
};
|
|
265
|
+
const dropBodyParameter = !!operation.details.default.dropBodyParameter;
|
|
266
|
+
// loop thru the parameters of the command operation, and if there is a body parameter, expand it if necessary.
|
|
267
|
+
for (const parameter of linq_1.values(operation.parameters)) {
|
|
268
|
+
if (parameter.details.default.constantValue) {
|
|
269
|
+
// this parameter has a constant value -- SKIP IT
|
|
270
|
+
continue;
|
|
271
|
+
}
|
|
272
|
+
// dolauli fromhost and apiversion are not exposed, this if block looks useless
|
|
273
|
+
if (parameter.details.default.fromHost || parameter.details.default.apiversion) {
|
|
274
|
+
// handled in the generator right now. Not exposed to the user directly.
|
|
275
|
+
continue;
|
|
276
|
+
}
|
|
277
|
+
if (dropBodyParameter && parameter.details.default.isBodyParameter) {
|
|
278
|
+
// the client will make a hidden body parameter for this, and we're expected to fill it.
|
|
279
|
+
const vps = parameter.schema.language.default.virtualProperties;
|
|
280
|
+
if (vps) {
|
|
281
|
+
for (const virtualProperty of [...vps.inherited, ...vps.owned, ...vps.inlined]) {
|
|
282
|
+
// dolauli add virtual parameter for virtual property
|
|
283
|
+
if (virtualProperty.private || virtualProperty.readOnly || virtualProperty.property.readOnly || virtualProperty.property.language.default.constantValue !== undefined || virtualProperty.property.language.default.HeaderProperty === 'Header') {
|
|
284
|
+
// private or readonly properties aren't needed as parameters.
|
|
285
|
+
continue;
|
|
286
|
+
}
|
|
287
|
+
virtualParameters.body.push({
|
|
288
|
+
name: virtualProperty.name,
|
|
289
|
+
description: virtualProperty.property.language.default.description,
|
|
290
|
+
nameOptions: virtualProperty.nameOptions,
|
|
291
|
+
required: virtualProperty.required,
|
|
292
|
+
schema: virtualProperty.property.schema,
|
|
293
|
+
origin: virtualProperty,
|
|
294
|
+
alias: []
|
|
295
|
+
});
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
else {
|
|
300
|
+
// dolauli if not drop body or not body parameter add it to operation
|
|
301
|
+
virtualParameters.operation.push({
|
|
302
|
+
name: parameter.details.default.name,
|
|
303
|
+
nameOptions: [parameter.details.default.name],
|
|
304
|
+
description: parameter.details.default.description,
|
|
305
|
+
required: parameter.details.default.isBodyParameter ? true : parameter.required,
|
|
306
|
+
schema: parameter.schema,
|
|
307
|
+
origin: parameter,
|
|
308
|
+
alias: []
|
|
309
|
+
});
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
resolve_conflicts_1.resolveParameterNames([], virtualParameters);
|
|
313
|
+
// dolauli see operation.details.default.virtualParameters
|
|
314
|
+
operation.details.default.virtualParameters = virtualParameters;
|
|
315
|
+
}
|
|
316
|
+
async function createVirtuals(state) {
|
|
317
|
+
/*
|
|
318
|
+
A model class should provide inlined properties for anything in a property called properties
|
|
319
|
+
|
|
320
|
+
Classes that have $THRESHOLD number of properties should be inlined.
|
|
321
|
+
|
|
322
|
+
Individual models can change the $THRESHOLD for generate
|
|
323
|
+
*/
|
|
324
|
+
const threshold = await state.getValue('inlining-threshold', 24);
|
|
325
|
+
const conflicts = new Array();
|
|
326
|
+
for (const schema of linq_1.values(state.model.schemas.objects)) {
|
|
327
|
+
// did we already inline this objecct
|
|
328
|
+
if (schema.language.default.inlined) {
|
|
329
|
+
continue;
|
|
330
|
+
}
|
|
331
|
+
// we have an object, let's process it.
|
|
332
|
+
createVirtualProperties(schema, new Array(), threshold, conflicts);
|
|
333
|
+
}
|
|
334
|
+
if (linq_1.length(conflicts) > 0) {
|
|
335
|
+
// dolauli need to figure out how inline-properties is used in README.md
|
|
336
|
+
state.error('You have one or more circular references in your model, you must add configuration entries to specify which models won\'t be inlined.', ['inline-properties']);
|
|
337
|
+
for (const each of conflicts) {
|
|
338
|
+
state.error(each, ['circular reference']);
|
|
339
|
+
}
|
|
340
|
+
throw new Error('Circular references exists, must mark models as `no-inline`');
|
|
341
|
+
}
|
|
342
|
+
//dolauli update operations under commands
|
|
343
|
+
for (const operation of linq_1.values(state.model.commands.operations)) {
|
|
344
|
+
createVirtualParameters(operation);
|
|
345
|
+
}
|
|
346
|
+
return state.model;
|
|
347
|
+
}
|
|
348
|
+
async function createInlinedPropertiesPlugin(service) {
|
|
349
|
+
//const session = await startSession<PwshModel>(service, {}, codeModelSchema);
|
|
350
|
+
//const result = tweakModelV2(session);
|
|
351
|
+
const state = await new model_state_1.ModelState(service).init();
|
|
352
|
+
await service.WriteFile('code-model-v4-create-virtual-properties-v2.yaml', codegen_1.serialize(await createVirtuals(state)), undefined, 'code-model-v4');
|
|
353
|
+
//return processCodeModel(createVirtuals, service, 'create-virtual-properties-v2');
|
|
354
|
+
}
|
|
355
|
+
exports.createInlinedPropertiesPlugin = createInlinedPropertiesPlugin;
|
|
356
|
+
//# sourceMappingURL=plugin-create-inline-properties.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin-create-inline-properties.js","sourceRoot":"","sources":["../../plugins/plugin-create-inline-properties.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;AAEhG,sDAAmQ;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5E;IACD,IAAI,aAAM,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE;QACzB,wEAAwE;QACxE,KAAK,CAAC,KAAK,CAAC,uIAAuI,EAAE,CAAC,mBAAmB,CAAC,CAAC,CAAC;QAC5K,KAAK,MAAM,IAAI,IAAI,SAAS,EAAE;YAC5B,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,oBAAoB,CAAC,CAAC,CAAC;SAC3C;QACD,MAAM,IAAI,KAAK,CAAC,6DAA6D,CAAC,CAAC;KAChF;IACD,0CAA0C;IAC1C,KAAK,MAAM,SAAS,IAAI,aAAM,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE;QAC/D,uBAAuB,CAAC,SAAS,CAAC,CAAC;KACpC;IAED,OAAO,KAAK,CAAC,KAAK,CAAC;AACrB,CAAC;AAGM,KAAK,UAAU,6BAA6B,CAAC,OAAa;IAC/D,8EAA8E;IAC9E,uCAAuC;IACvC,MAAM,KAAK,GAAG,MAAM,IAAI,wBAAU,CAAY,OAAO,CAAC,CAAC,IAAI,EAAE,CAAC;IAC9D,MAAM,OAAO,CAAC,SAAS,CAAC,iDAAiD,EAAE,mBAAS,CAAC,MAAM,cAAc,CAAC,KAAK,CAAC,CAAC,EAAE,SAAS,EAAE,eAAe,CAAC,CAAC;IAC/I,mFAAmF;AACrF,CAAC;AAND,sEAMC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin-tweak-m4-model.d.ts","sourceRoot":"","sources":["../../plugins/plugin-tweak-m4-model.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,IAAI,EAAE,MAAM,sCAAsC,CAAC;AA0K5D,wBAAsB,kBAAkB,CAAC,OAAO,EAAE,IAAI,iBAKrD"}
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
/*---------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
5
|
+
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
6
|
+
*--------------------------------------------------------------------------------------------*/
|
|
7
|
+
const codemodel_1 = require("@azure-tools/codemodel");
|
|
8
|
+
const codegen_1 = require("@azure-tools/codegen");
|
|
9
|
+
const model_state_1 = require("../utils/model-state");
|
|
10
|
+
const http_definitions_1 = require("../utils/http-definitions");
|
|
11
|
+
const linq_1 = require("@azure-tools/linq");
|
|
12
|
+
let directives = [];
|
|
13
|
+
async function tweakModel(state) {
|
|
14
|
+
const model = state.model;
|
|
15
|
+
addResponseHeaderSchema(model);
|
|
16
|
+
addDictionaryApiVersion(model);
|
|
17
|
+
removeM4DefaultDescription(model);
|
|
18
|
+
handleNoinlineDirective(state);
|
|
19
|
+
return model;
|
|
20
|
+
}
|
|
21
|
+
function handleNoinlineDirective(state) {
|
|
22
|
+
var inlineModels = new Array;
|
|
23
|
+
for (const directive of directives.filter(each => each['no-inline'])) {
|
|
24
|
+
inlineModels = inlineModels.concat(linq_1.values(directive['no-inline']).toArray());
|
|
25
|
+
}
|
|
26
|
+
for (const model of state.model.schemas.objects || []) {
|
|
27
|
+
if (inlineModels.includes(model.language.default.name)) {
|
|
28
|
+
model.language.default['skip-inline'] = true;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
function addResponseHeaderSchema(model) {
|
|
33
|
+
// In remodeler, each operations response headers will has its own scheam. Each header will be schema's property.
|
|
34
|
+
// But in m4, if 'schema' is not explicitly defined, even 'headers' is specified, there won't be a schema for headers.
|
|
35
|
+
// To keep backward compatiable, we will create headers schema here
|
|
36
|
+
model.operationGroups.forEach((group) => {
|
|
37
|
+
var _a;
|
|
38
|
+
(_a = group.operations) === null || _a === void 0 ? void 0 : _a.forEach((op) => {
|
|
39
|
+
if (!op.responses) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
op.responses.forEach((resp) => {
|
|
43
|
+
var _a, _b, _c, _d;
|
|
44
|
+
if (resp.schema) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
const headers = (_a = resp.protocol.http) === null || _a === void 0 ? void 0 : _a.headers;
|
|
48
|
+
if (headers === undefined) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
const responseCode = (_c = (_b = resp.protocol.http) === null || _b === void 0 ? void 0 : _b.statusCodes) === null || _c === void 0 ? void 0 : _c[0];
|
|
52
|
+
if (responseCode === undefined) {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
// Follow naming pattern in m3
|
|
56
|
+
const code = (http_definitions_1.StatusCodes[responseCode] || '') || responseCode;
|
|
57
|
+
const schemaName = `${group.language.default.name}_${op.language.default.name} ${code} ResponseHeaders`;
|
|
58
|
+
const newSchema = ((_d = model.schemas.objects) === null || _d === void 0 ? void 0 : _d.find((schema) => schema.language.default.name === schemaName)) ||
|
|
59
|
+
new codemodel_1.ObjectSchema(schemaName, '');
|
|
60
|
+
newSchema.language.default.isHeaderModel = true;
|
|
61
|
+
if (!model.schemas.objects) {
|
|
62
|
+
model.schemas.objects = [];
|
|
63
|
+
}
|
|
64
|
+
model.schemas.objects.push(newSchema);
|
|
65
|
+
headers.forEach((head) => {
|
|
66
|
+
// We lost description and x-ms-client-name in m4. So newProp's description is empty and use header as serializedName
|
|
67
|
+
const newProp = new codemodel_1.Property(head.header, '', head.schema, {
|
|
68
|
+
readOnly: false,
|
|
69
|
+
required: false,
|
|
70
|
+
serializedName: head.header
|
|
71
|
+
});
|
|
72
|
+
newProp.language.default.HeaderProperty = 'Header';
|
|
73
|
+
if (!newSchema.properties) {
|
|
74
|
+
newSchema.properties = [];
|
|
75
|
+
}
|
|
76
|
+
newSchema.properties.push(newProp);
|
|
77
|
+
});
|
|
78
|
+
// Set response header use new schema
|
|
79
|
+
resp.language.default.headerSchema = newSchema;
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
function addDictionaryApiVersion(model) {
|
|
85
|
+
var _a, _b;
|
|
86
|
+
(_a = model.schemas.dictionaries) === null || _a === void 0 ? void 0 : _a.forEach((schema) => {
|
|
87
|
+
if (schema.apiVersions) {
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
if (schema.elementType && schema.elementType.apiVersions) {
|
|
91
|
+
schema.apiVersions = JSON.parse(JSON.stringify(schema.elementType.apiVersions));
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
// If we cannot find api version from element type, try to get it from object schema who refers the dict or any.
|
|
95
|
+
(_b = model.schemas.objects) === null || _b === void 0 ? void 0 : _b.forEach((schema) => {
|
|
96
|
+
var _a;
|
|
97
|
+
if (!schema.apiVersions) {
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
for (const prop of codemodel_1.getAllProperties(schema)) {
|
|
101
|
+
if (prop.schema.type !== codemodel_1.SchemaType.Dictionary || prop.schema.apiVersions) {
|
|
102
|
+
continue;
|
|
103
|
+
}
|
|
104
|
+
prop.schema.apiVersions = JSON.parse(JSON.stringify(schema.apiVersions));
|
|
105
|
+
}
|
|
106
|
+
if (schema.parents) {
|
|
107
|
+
for (const parent of (_a = schema.parents) === null || _a === void 0 ? void 0 : _a.all) {
|
|
108
|
+
if (parent.type !== codemodel_1.SchemaType.Dictionary || parent.apiVersions) {
|
|
109
|
+
continue;
|
|
110
|
+
}
|
|
111
|
+
// for object which both contains properties and additional properties,
|
|
112
|
+
// we need to skip the model generation for redundant dict.
|
|
113
|
+
parent.language.default.skip = true;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
function removeM4DefaultDescription(model) {
|
|
119
|
+
// For dictionary and arrya schema and property, if there is no description assigned, m4 will set a default description like: Dictionary of <type> or Array of <type>
|
|
120
|
+
// To keep same action as m3, we will set it to empty string
|
|
121
|
+
var _a, _b, _c;
|
|
122
|
+
const visited = new Set();
|
|
123
|
+
[...(_a = model.schemas.objects, (_a !== null && _a !== void 0 ? _a : [])), ...(_b = model.schemas.dictionaries, (_b !== null && _b !== void 0 ? _b : [])), ...(_c = model.schemas.arrays, (_c !== null && _c !== void 0 ? _c : []))].forEach((schema) => {
|
|
124
|
+
recursiveRemoveM4DefaultDescription(schema, visited);
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
function recursiveRemoveM4DefaultDescription(schema, visited) {
|
|
128
|
+
if (visited.has(schema) || (schema.type !== codemodel_1.SchemaType.Object && schema.type !== codemodel_1.SchemaType.Dictionary && schema.type !== codemodel_1.SchemaType.Array)) {
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
// Default description pattern in m4
|
|
132
|
+
const defaultDictDescPattern = /Dictionary of <.?>$/;
|
|
133
|
+
const defaultArrayDescPattern = /Array of .?$/;
|
|
134
|
+
visited.add(schema);
|
|
135
|
+
if (schema.type === codemodel_1.SchemaType.Dictionary) {
|
|
136
|
+
const dictSchema = schema;
|
|
137
|
+
recursiveRemoveM4DefaultDescription(dictSchema.elementType, visited);
|
|
138
|
+
if (defaultDictDescPattern.test(dictSchema.language.default.description)) {
|
|
139
|
+
dictSchema.language.default.description = '';
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
else if (schema.type === codemodel_1.SchemaType.Array) {
|
|
143
|
+
const arrSchema = schema;
|
|
144
|
+
recursiveRemoveM4DefaultDescription(arrSchema.elementType, visited);
|
|
145
|
+
if (defaultArrayDescPattern.test(schema.language.default.description)) {
|
|
146
|
+
schema.language.default.description = '';
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
else if (schema.type === codemodel_1.SchemaType.Object) {
|
|
150
|
+
const objSchema = schema;
|
|
151
|
+
for (const prop of codemodel_1.getAllProperties(objSchema)) {
|
|
152
|
+
recursiveRemoveM4DefaultDescription(prop.schema, visited);
|
|
153
|
+
if (prop.schema.type === codemodel_1.SchemaType.Dictionary && (defaultDictDescPattern.test(prop.language.default.description) || defaultArrayDescPattern.test(prop.language.default.description))) {
|
|
154
|
+
prop.language.default.description = '';
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
async function tweakM4ModelPlugin(service) {
|
|
160
|
+
const allDirectives = await service.GetValue('directive');
|
|
161
|
+
directives = linq_1.values(allDirectives).toArray();
|
|
162
|
+
const state = await new model_state_1.ModelState(service).init();
|
|
163
|
+
service.WriteFile('code-model-v4-tweakm4codemodel.yaml', codegen_1.serialize(await tweakModel(state)), undefined, 'code-model-v4');
|
|
164
|
+
}
|
|
165
|
+
exports.tweakM4ModelPlugin = tweakM4ModelPlugin;
|
|
166
|
+
//# sourceMappingURL=plugin-tweak-m4-model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin-tweak-m4-model.js","sourceRoot":"","sources":["../../plugins/plugin-tweak-m4-model.ts"],"names":[],"mappings":";;AAAA;;;gGAGgG;AAChG,sDAA4J;AAC5J,kDAAiD;AAEjD,sDAAkD;AAClD,gEAAwD;AACxD,4CAA4E;AAM5E,IAAI,UAAU,GAAe,EAAE,CAAC;AAEhC,KAAK,UAAU,UAAU,CAAC,KAAY;IACpC,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;IAE1B,uBAAuB,CAAC,KAAK,CAAC,CAAC;IAE/B,uBAAuB,CAAC,KAAK,CAAC,CAAC;IAE/B,0BAA0B,CAAC,KAAK,CAAC,CAAC;IAElC,uBAAuB,CAAC,KAAK,CAAC,CAAC;IAE/B,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,uBAAuB,CAAC,KAAY;IAC3C,IAAI,YAAY,GAAa,IAAI,KAAK,CAAC;IACvC,KAAK,MAAM,SAAS,IAAI,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,EAAE;QACpE,YAAY,GAAG,YAAY,CAAC,MAAM,CAAsB,aAAM,CAAC,SAAS,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