diff --git a/CHANGELOG.md b/CHANGELOG.md index 2d6facbca6..784c561868 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,11 +14,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed +- Fixed a bug where multiple Visual Studio Code instances would make the extension install/update fail. [#3686](https://github.com/microsoft/kiota/issues/3686) +- Fixed a bug where models properties named "additionalData" or "backingstore" would be ignored. [#4224](https://github.com/microsoft/kiota/issues/4224) - PREVIEW: Renamed the config commands to workspace. [#4310](https://github.com/microsoft/kiota/issues/4310) - PREVIEW: Moved preview configuration files to the .kiota directory. [#4310](https://github.com/microsoft/kiota/issues/4310) - PREVIEW: Moved the copy descriptions to dedicated folders. [#4310](https://github.com/microsoft/kiota/issues/4310) - PREVIEW: Renamed the config to workspace file. [#4310](https://github.com/microsoft/kiota/issues/4310) +- Fixed a bug where TypeScript generation would consider boolean argument as empty when false. [#4103](https://github.com/microsoft/kiota/issues/4103) - Changed Csharp code generation to put braces on new lines (where it makes sense). [#4347](https://github.com/microsoft/kiota/issues/4347) +- TypeScript is now a preview language! ## [1.12.0] - 2024-03-06 diff --git a/it/csharp/dotnet.csproj b/it/csharp/dotnet.csproj index 8e77c45d57..47a0571d79 100644 --- a/it/csharp/dotnet.csproj +++ b/it/csharp/dotnet.csproj @@ -10,7 +10,7 @@ - + diff --git a/it/typescript/package-lock.json b/it/typescript/package-lock.json index 065dcd0d6a..b8c350f34a 100644 --- a/it/typescript/package-lock.json +++ b/it/typescript/package-lock.json @@ -10,14 +10,14 @@ "license": "MIT", "dependencies": { "@azure/identity": "^4.0.1", - "@microsoft/kiota-abstractions": "^1.0.0-preview.47", - "@microsoft/kiota-authentication-azure": "^1.0.0-preview.42", - "@microsoft/kiota-http-fetchlibrary": "^1.0.0-preview.46", - "@microsoft/kiota-serialization-form": "^1.0.0-preview.36", - "@microsoft/kiota-serialization-json": "^1.0.0-preview.47", - "@microsoft/kiota-serialization-multipart": "^1.0.0-preview.26", - "@microsoft/kiota-serialization-text": "^1.0.0-preview.44", - "express": "^4.18.3", + "@microsoft/kiota-abstractions": "^1.0.0-preview.48", + "@microsoft/kiota-authentication-azure": "^1.0.0-preview.43", + "@microsoft/kiota-http-fetchlibrary": "^1.0.0-preview.47", + "@microsoft/kiota-serialization-form": "^1.0.0-preview.37", + "@microsoft/kiota-serialization-json": "^1.0.0-preview.48", + "@microsoft/kiota-serialization-multipart": "^1.0.0-preview.27", + "@microsoft/kiota-serialization-text": "^1.0.0-preview.45", + "express": "^4.19.1", "node-fetch": "^2.7.0" }, "devDependencies": { @@ -678,12 +678,12 @@ "dev": true }, "node_modules/@microsoft/kiota-abstractions": { - "version": "1.0.0-preview.47", - "resolved": "https://registry.npmjs.org/@microsoft/kiota-abstractions/-/kiota-abstractions-1.0.0-preview.47.tgz", - "integrity": "sha512-/aCyFHFzIXKiBP3CKs56V7R0IoZTSA9CJRmxYh1hea6v10Y2DO75g+XZpd6Ry9Z7MHzbytM12ppy+buz7Qlsiw==", + "version": "1.0.0-preview.48", + "resolved": "https://registry.npmjs.org/@microsoft/kiota-abstractions/-/kiota-abstractions-1.0.0-preview.48.tgz", + "integrity": "sha512-a7JnqfQqdBKbmZoWJkWrARyIEALvNu7b8EJCXE7AaXT439AlrAQSPrqsjS7hock8cYUeHQZ3MFExkPDEF+jqog==", "dependencies": { "@opentelemetry/api": "^1.7.0", - "@std-uritemplate/std-uritemplate": "^0.0.54", + "@std-uritemplate/std-uritemplate": "^0.0.55", "guid-typescript": "^1.0.9", "tinyduration": "^3.3.0", "tslib": "^2.6.2", @@ -703,51 +703,51 @@ } }, "node_modules/@microsoft/kiota-authentication-azure": { - "version": "1.0.0-preview.42", - "resolved": "https://registry.npmjs.org/@microsoft/kiota-authentication-azure/-/kiota-authentication-azure-1.0.0-preview.42.tgz", - "integrity": "sha512-VUQ7qxF55iFppI6gEwrNHtvHzklnXby2Pjh1/tWrjVA9wCgUu3CSfb4SqelbNqm2WecEZhfkxp3yJaazBR718w==", + "version": "1.0.0-preview.43", + "resolved": "https://registry.npmjs.org/@microsoft/kiota-authentication-azure/-/kiota-authentication-azure-1.0.0-preview.43.tgz", + "integrity": "sha512-nzHlfXKpDNig5XGRSAlNrZxK3HTVLPBnLsrsQE8cb02sfB+EbUGGW36F+H2d9P2wc5hPp3PxyFx8TxZ1lrnR3g==", "dependencies": { "@azure/core-auth": "^1.5.0", - "@microsoft/kiota-abstractions": "^1.0.0-preview.47", + "@microsoft/kiota-abstractions": "^1.0.0-preview.48", "@opentelemetry/api": "^1.7.0", "tslib": "^2.6.2" } }, "node_modules/@microsoft/kiota-http-fetchlibrary": { - "version": "1.0.0-preview.46", - "resolved": "https://registry.npmjs.org/@microsoft/kiota-http-fetchlibrary/-/kiota-http-fetchlibrary-1.0.0-preview.46.tgz", - "integrity": "sha512-vcZ+zK5e2kwgzNCM/AcVJSWu7iG7QYcg+yytgeda9FLopVRbvneIpqbGYJNULosetIunx7GpSvXy9hYJhqPecw==", + "version": "1.0.0-preview.47", + "resolved": "https://registry.npmjs.org/@microsoft/kiota-http-fetchlibrary/-/kiota-http-fetchlibrary-1.0.0-preview.47.tgz", + "integrity": "sha512-2xz1uNuLo3qbtolwWmQ5wP4URad9N896s8lbXsAmviey+8nO2qfOtvILqSHQXkPKfrQXMlw5Q1rxJBeluODGoQ==", "dependencies": { - "@microsoft/kiota-abstractions": "^1.0.0-preview.47", + "@microsoft/kiota-abstractions": "^1.0.0-preview.48", "@opentelemetry/api": "^1.7.0", "guid-typescript": "^1.0.9", "tslib": "^2.6.2" } }, "node_modules/@microsoft/kiota-serialization-form": { - "version": "1.0.0-preview.36", - "resolved": "https://registry.npmjs.org/@microsoft/kiota-serialization-form/-/kiota-serialization-form-1.0.0-preview.36.tgz", - "integrity": "sha512-SuDXwyYbP0O/bQnuCuz696sYhfRDlGC7L1nW83NSN4mt+cFOdZ5b/bQkUDjKSY3aSMHhNsjsXfoVf0cgTqUWJQ==", + "version": "1.0.0-preview.37", + "resolved": "https://registry.npmjs.org/@microsoft/kiota-serialization-form/-/kiota-serialization-form-1.0.0-preview.37.tgz", + "integrity": "sha512-P4gAZcg0eJotPXJSaVtEyIA23OnI8P9JG6m4zdo2FkrqsPn6GE0seuNxv8NlxUOQPN/qg2H0PMIBVOcJsaL+3w==", "dependencies": { - "@microsoft/kiota-abstractions": "^1.0.0-preview.47", + "@microsoft/kiota-abstractions": "^1.0.0-preview.48", "guid-typescript": "^1.0.9", "tslib": "^2.6.2" } }, "node_modules/@microsoft/kiota-serialization-json": { - "version": "1.0.0-preview.47", - "resolved": "https://registry.npmjs.org/@microsoft/kiota-serialization-json/-/kiota-serialization-json-1.0.0-preview.47.tgz", - "integrity": "sha512-ckXsvkdspqM4pwpX+g+oH4x56jNBrjWbPA6FBLdK0itUoqa9ntE8qz6pyREeIgjFSHCq9VhirBKznhsIFeofmQ==", + "version": "1.0.0-preview.48", + "resolved": "https://registry.npmjs.org/@microsoft/kiota-serialization-json/-/kiota-serialization-json-1.0.0-preview.48.tgz", + "integrity": "sha512-pQnXd+G6qRFOw2yId9by1jCuseYeeK2cSsYBfFiWvqz9x9WfcQcA/LfCWOSAkgeRfJcB4KQCcltgLeMCqnmVkA==", "dependencies": { - "@microsoft/kiota-abstractions": "^1.0.0-preview.47", + "@microsoft/kiota-abstractions": "^1.0.0-preview.48", "guid-typescript": "^1.0.9", "tslib": "^2.6.2" } }, "node_modules/@microsoft/kiota-serialization-multipart": { - "version": "1.0.0-preview.26", - "resolved": "https://registry.npmjs.org/@microsoft/kiota-serialization-multipart/-/kiota-serialization-multipart-1.0.0-preview.26.tgz", - "integrity": "sha512-0RlPYL6BzyPVN3PlWIApCnBKVxWGAMxkIuMSc9KYesLhcKboHNHjiiJyiatgGkSpHqZV3cQcg4bj2RYi/8+ITA==", + "version": "1.0.0-preview.27", + "resolved": "https://registry.npmjs.org/@microsoft/kiota-serialization-multipart/-/kiota-serialization-multipart-1.0.0-preview.27.tgz", + "integrity": "sha512-B7JT0QRaqnvXJt+fLP9RPKG+MIUmeh05KatEH5EdsrPKPbdPUzNesS3vwFCFVsfGJyaQTS5UybIZ6AAegMP1eA==", "dependencies": { "@microsoft/kiota-abstractions": "^1.0.0-preview.47", "guid-typescript": "^1.0.9", @@ -755,11 +755,11 @@ } }, "node_modules/@microsoft/kiota-serialization-text": { - "version": "1.0.0-preview.44", - "resolved": "https://registry.npmjs.org/@microsoft/kiota-serialization-text/-/kiota-serialization-text-1.0.0-preview.44.tgz", - "integrity": "sha512-lUT55JfaNEEygWJ5ZV61PQqDKA8Q3KDq9WLH5vqoY8ZFFE3/D5xxCVxWP4ssEE+CzniLRa63Pgqnm05bEqHV0w==", + "version": "1.0.0-preview.45", + "resolved": "https://registry.npmjs.org/@microsoft/kiota-serialization-text/-/kiota-serialization-text-1.0.0-preview.45.tgz", + "integrity": "sha512-MqTBDO8mEysMuHn5akFi8sKeIkAzYSjX7GS43VJvzxa3eLj95X0iJCz2Br7TOPWJ6WOJnqfdsqzAYvgzIHAdKw==", "dependencies": { - "@microsoft/kiota-abstractions": "^1.0.0-preview.47", + "@microsoft/kiota-abstractions": "^1.0.0-preview.48", "guid-typescript": "^1.0.9", "tslib": "^2.6.2" } @@ -808,9 +808,9 @@ } }, "node_modules/@std-uritemplate/std-uritemplate": { - "version": "0.0.54", - "resolved": "https://registry.npmjs.org/@std-uritemplate/std-uritemplate/-/std-uritemplate-0.0.54.tgz", - "integrity": "sha512-YPpDc0LA5rhl/X70IX08gVsDhQiE/L4otnAssB97GQgGnw1nvfTfrR6jMuhhj9wWm3L1qVJgno5SraboXZhIGQ==" + "version": "0.0.55", + "resolved": "https://registry.npmjs.org/@std-uritemplate/std-uritemplate/-/std-uritemplate-0.0.55.tgz", + "integrity": "sha512-zawaTail2WdTwy3OkzJPzQR9cCcF1LNlvo8ymDeaV9QL7Ku5Lf31dtOZUbDD5c70YVDG5QYPwEsWa7wiWS4zzw==" }, "node_modules/@tootallnate/once": { "version": "2.0.0", @@ -1345,9 +1345,9 @@ } }, "node_modules/cookie": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.5.0.tgz", - "integrity": "sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw==", + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.6.0.tgz", + "integrity": "sha512-U71cyTamuh1CRNCfpGY6to28lxvNwPG4Guz/EVjgf3Jmzv0vlDp1atT9eS5dDjMYHucpHbWns6Lwf3BKz6svdw==", "engines": { "node": ">= 0.6" } @@ -1732,16 +1732,16 @@ } }, "node_modules/express": { - "version": "4.18.3", - "resolved": "https://registry.npmjs.org/express/-/express-4.18.3.tgz", - "integrity": "sha512-6VyCijWQ+9O7WuVMTRBTl+cjNNIzD5cY5mQ1WM8r/LEkI2u8EYpOotESNwzNlyCn3g+dmjKYI6BmNneSr/FSRw==", + "version": "4.19.1", + "resolved": "https://registry.npmjs.org/express/-/express-4.19.1.tgz", + "integrity": "sha512-K4w1/Bp7y8iSiVObmCrtq8Cs79XjJc/RU2YYkZQ7wpUu5ZyZ7MtPHkqoMz4pf+mgXfNvo2qft8D9OnrH2ABk9w==", "dependencies": { "accepts": "~1.3.8", "array-flatten": "1.1.1", "body-parser": "1.20.2", "content-disposition": "0.5.4", "content-type": "~1.0.4", - "cookie": "0.5.0", + "cookie": "0.6.0", "cookie-signature": "1.0.6", "debug": "2.6.9", "depd": "2.0.0", diff --git a/it/typescript/package.json b/it/typescript/package.json index fe51f7bfb9..a9dfa3c2fe 100644 --- a/it/typescript/package.json +++ b/it/typescript/package.json @@ -31,14 +31,14 @@ }, "dependencies": { "@azure/identity": "^4.0.1", - "@microsoft/kiota-abstractions": "^1.0.0-preview.47", - "@microsoft/kiota-authentication-azure": "^1.0.0-preview.42", - "@microsoft/kiota-http-fetchlibrary": "^1.0.0-preview.46", - "@microsoft/kiota-serialization-form": "^1.0.0-preview.36", - "@microsoft/kiota-serialization-json": "^1.0.0-preview.47", - "@microsoft/kiota-serialization-multipart": "^1.0.0-preview.26", - "@microsoft/kiota-serialization-text": "^1.0.0-preview.44", - "express": "^4.18.3", + "@microsoft/kiota-abstractions": "^1.0.0-preview.48", + "@microsoft/kiota-authentication-azure": "^1.0.0-preview.43", + "@microsoft/kiota-http-fetchlibrary": "^1.0.0-preview.47", + "@microsoft/kiota-serialization-form": "^1.0.0-preview.37", + "@microsoft/kiota-serialization-json": "^1.0.0-preview.48", + "@microsoft/kiota-serialization-multipart": "^1.0.0-preview.27", + "@microsoft/kiota-serialization-text": "^1.0.0-preview.45", + "express": "^4.19.1", "node-fetch": "^2.7.0" } } diff --git a/src/Kiota.Builder/CodeDOM/CodeClass.cs b/src/Kiota.Builder/CodeDOM/CodeClass.cs index a46e5c1b79..41a41061c2 100644 --- a/src/Kiota.Builder/CodeDOM/CodeClass.cs +++ b/src/Kiota.Builder/CodeDOM/CodeClass.cs @@ -167,7 +167,7 @@ private string ResolveUniquePropertyName(string name) ArgumentException.ThrowIfNullOrEmpty(serializationName); if (BaseClass is CodeClass currentParentClass) - if (currentParentClass.FindPropertyByWireName(serializationName) is CodeProperty currentProperty && !currentProperty.ExistsInBaseType) + if (currentParentClass.FindPropertyByWireName(serializationName) is CodeProperty currentProperty && !currentProperty.ExistsInBaseType && currentProperty.Kind is not CodePropertyKind.AdditionalData or CodePropertyKind.BackingStore) return currentProperty; else return currentParentClass.GetOriginalPropertyDefinedFromBaseType(serializationName); diff --git a/src/Kiota.Builder/Kiota.Builder.csproj b/src/Kiota.Builder/Kiota.Builder.csproj index 3f3aeced98..113d2526ed 100644 --- a/src/Kiota.Builder/Kiota.Builder.csproj +++ b/src/Kiota.Builder/Kiota.Builder.csproj @@ -38,7 +38,7 @@ - + diff --git a/src/Kiota.Builder/Writers/TypeScript/CodeFunctionWriter.cs b/src/Kiota.Builder/Writers/TypeScript/CodeFunctionWriter.cs index c5b809c950..0e54393520 100644 --- a/src/Kiota.Builder/Writers/TypeScript/CodeFunctionWriter.cs +++ b/src/Kiota.Builder/Writers/TypeScript/CodeFunctionWriter.cs @@ -259,7 +259,7 @@ private static string GetDefaultValueLiteralForProperty(CodeProperty codePropert return $"{enumDefinition.CodeEnumObject.Name.ToFirstCharacterUpperCase()}.{codeProperty.DefaultValue.Trim('"').CleanupSymbolName().ToFirstCharacterUpperCase()}"; return codeProperty.DefaultValue; } - private static void WriteDefensiveStatements(CodeMethod codeElement, LanguageWriter writer) + private void WriteDefensiveStatements(CodeMethod codeElement, LanguageWriter writer) { if (codeElement.IsOfKind(CodeMethodKind.Setter)) return; @@ -271,7 +271,8 @@ private static void WriteDefensiveStatements(CodeMethod codeElement, LanguageWri .OrderBy(static x => x.Name, StringComparer.OrdinalIgnoreCase)) { var parameterName = parameter.Name.ToFirstCharacterLowerCase(); - writer.WriteLine($"if(!{parameterName}) throw new Error(\"{parameterName} cannot be undefined\");"); + if (!"boolean".Equals(conventions.TranslateType(parameter.Type), StringComparison.OrdinalIgnoreCase)) + writer.WriteLine($"if(!{parameterName}) throw new Error(\"{parameterName} cannot be undefined\");"); } } private string GetDeserializationMethodName(CodeTypeBase propType, CodeFunction codeFunction) diff --git a/src/kiota/appsettings.json b/src/kiota/appsettings.json index 7dbe24b66d..d4b156635a 100644 --- a/src/kiota/appsettings.json +++ b/src/kiota/appsettings.json @@ -129,7 +129,7 @@ "DependencyInstallCommand": "go get {0}@{1}" }, "TypeScript": { - "MaturityLevel": "Experimental", + "MaturityLevel": "Preview", "Dependencies": [ { "Name": "@microsoft/kiota-abstractions", @@ -284,4 +284,4 @@ "DependencyInstallCommand": "dotnet add package {0} --version {1}" } } -} \ No newline at end of file +} diff --git a/tests/Kiota.Builder.Tests/KiotaBuilderTests.cs b/tests/Kiota.Builder.Tests/KiotaBuilderTests.cs index 7ef4885062..3cf5b8bbd0 100644 --- a/tests/Kiota.Builder.Tests/KiotaBuilderTests.cs +++ b/tests/Kiota.Builder.Tests/KiotaBuilderTests.cs @@ -697,6 +697,83 @@ public async Task TrimsInheritanceUnusedModels() Assert.Null(modelsNS.FindChildByName("AuditEvent", false)); //unused type } [Fact] + public async Task DisambiguatesReservedProperties() + { + var tempFilePath = Path.Combine(Path.GetTempPath(), Path.GetTempFileName()); + await using var fs = await GetDocumentStream(@"openapi: 3.0.1 +info: + title: OData Service for namespace microsoft.graph + description: This OData service is located at https://graph.microsoft.com/v1.0 + version: v1.0 + x-ms-generated-by: + toolName: Microsoft.OpenApi.OData + toolVersion: 1.0.9.0 +servers: + - url: https://graph.microsoft.com/v1.0 +paths: + '/security/alerts_v2/{alert-id}': + get: + responses: + 200: + content: + application/json: + schema: + $ref: '#/components/schemas/microsoft.graph.alert' +components: + schemas: + microsoft.graph.entity: + title: entity + required: + - '@odata.type' + type: object + properties: + id: + type: string + '@odata.type': + type: string + microsoft.graph.dictionary: + title: dictionary + required: + - '@odata.type' + type: object + properties: + '@odata.type': + type: string + microsoft.graph.alert: + allOf: + - $ref: '#/components/schemas/microsoft.graph.entity' + - title: alert + required: + - '@odata.type' + type: object + properties: + actorDisplayName: + type: string + nullable: true + additionalData: + anyOf: + - $ref: '#/components/schemas/microsoft.graph.dictionary' + - type: object + nullable: true"); + var mockLogger = new Mock>(); + var builder = new KiotaBuilder(mockLogger.Object, new GenerationConfiguration { ClientClassName = "Graph", OpenAPIFilePath = tempFilePath }, _httpClient); + var document = await builder.CreateOpenApiDocumentAsync(fs); + var node = builder.CreateUriSpace(document); + var codeModel = builder.CreateSourceModel(node); + var modelsNS = codeModel.FindNamespaceByName("ApiSdk.models.microsoft.graph"); + Assert.NotNull(modelsNS); + var entityClass = modelsNS.FindChildByName("Entity", false); + Assert.NotNull(entityClass); + var additionalDataProperty = entityClass.FindChildByName("AdditionalData", false); + Assert.NotNull(additionalDataProperty); + Assert.True(additionalDataProperty.Kind is CodePropertyKind.AdditionalData); + var alertClass = modelsNS.FindChildByName("Alert", false); + Assert.NotNull(alertClass); + var additionalDataEscapedProperty = alertClass.FindChildByName("AdditionalDataProperty", false); + Assert.NotNull(additionalDataEscapedProperty); + Assert.True(additionalDataEscapedProperty.Kind is CodePropertyKind.Custom); + } + [Fact] public async Task TrimsInheritanceUnusedModelsWithUnion() { var tempFilePath = Path.Combine(Path.GetTempPath(), Path.GetTempFileName()); diff --git a/tests/Kiota.Builder.Tests/Writers/TypeScript/CodeFunctionWriterTests.cs b/tests/Kiota.Builder.Tests/Writers/TypeScript/CodeFunctionWriterTests.cs index 8855644e50..a22dec13c7 100644 --- a/tests/Kiota.Builder.Tests/Writers/TypeScript/CodeFunctionWriterTests.cs +++ b/tests/Kiota.Builder.Tests/Writers/TypeScript/CodeFunctionWriterTests.cs @@ -717,6 +717,63 @@ public void WritesDeprecationInformationFromBuilder() var result = tw.ToString(); Assert.Contains("This method is obsolete. Use NewAwesomeMethod instead.", result); } + [Fact] + public void WritesDefensiveStatements() + { + var parentClass = root.AddClass(new CodeClass + { + Name = "ODataError", + Kind = CodeClassKind.Model, + }).First(); + parentClass.DiscriminatorInformation.DiscriminatorPropertyName = "@odata.type"; + parentClass.DiscriminatorInformation.AddDiscriminatorMapping("string", new CodeType() { Name = "string" }); + var method = TestHelper.CreateMethod(parentClass, MethodName, ReturnTypeName); + method.AddParameter(new CodeParameter + { + Name = "param1", + Type = new CodeType() + { + Name = "string", + IsNullable = false, + }, + }); + method.Kind = CodeMethodKind.Factory; + method.IsStatic = true; + method.Name = "NewAwesomeMethod";// new method replacement + var function = new CodeFunction(method); + root.TryAddCodeFile("foo", function); + writer.Write(function); + var result = tw.ToString(); + Assert.Contains("cannot be undefined", result); + } + [Fact] + public void DoesNotWriteDefensiveStatementsForBooleanParameters() + { + var parentClass = root.AddClass(new CodeClass + { + Name = "ODataError", + Kind = CodeClassKind.Model, + }).First(); + var method = TestHelper.CreateMethod(parentClass, MethodName, ReturnTypeName); + method.AddParameter(new CodeParameter + { + Name = "param1", + Type = new CodeType() + { + Name = "boolean", + IsNullable = false, + }, + Optional = false, + }); + method.Kind = CodeMethodKind.Factory; + method.IsStatic = true; + method.Name = "NewAwesomeMethod";// new method replacement + var function = new CodeFunction(method); + root.TryAddCodeFile("foo", function); + writer.Write(function); + var result = tw.ToString(); + Assert.DoesNotContain("cannot be undefined", result); + } private const string MethodDescription = "some description"; private const string ParamDescription = "some parameter description"; private const string ParamName = "paramName"; diff --git a/vscode/microsoft-kiota/l10n/bundle.l10n.ar.json b/vscode/microsoft-kiota/l10n/bundle.l10n.ar.json index 6178a1e326..cd58a7ee0e 100644 --- a/vscode/microsoft-kiota/l10n/bundle.l10n.ar.json +++ b/vscode/microsoft-kiota/l10n/bundle.l10n.ar.json @@ -23,7 +23,7 @@ "Enter an output path relative to the root of the project": "أدخل مسار إخراج في جذر المشروع", "Pick a language": "اختر لغة", "Downloading kiota requires an internet connection. Please check your connection and try again.": "يتطلب تنزيل kiota اتصالا بالإنترنت. يرجى التحقق من اتصالك والمحاولة مرة أخرى.", - "Kiota download failed. Check the extension host logs for more information.": "فشل تنزيل Kiota. تحقق من سجلات مضيف الإضافة للحصول على مزيد من المعلومات.", + "Kiota download failed. Try closing all Visual Studio Code windows and open only one. Check the extension host logs for more information.": "فشل تنزيل Kiota. تحقق من سجلات مضيف الإضافة للحصول على مزيد من المعلومات.", "Downloading kiota...": "جاري تنزيل Kiota...", "Generating client...": "انشاء العميل...", "Loading...": "جاري التحميل...", diff --git a/vscode/microsoft-kiota/l10n/bundle.l10n.es.json b/vscode/microsoft-kiota/l10n/bundle.l10n.es.json index 42a4260960..583ce974e3 100644 --- a/vscode/microsoft-kiota/l10n/bundle.l10n.es.json +++ b/vscode/microsoft-kiota/l10n/bundle.l10n.es.json @@ -23,7 +23,7 @@ "Enter an output path relative to the root of the project": "Ingrese una dirección para el producto relativa al root del proyecto", "Pick a language": "Seleccione un lenguaje", "Downloading kiota requires an internet connection. Please check your connection and try again.": "Desgargar Kiota requiere de conexión a internet. Por favor, revise su conexión e intente de nuevo.", - "Kiota download failed. Check the extension host logs for more information.": "Descarga de Kiota fallida. Revise la bitácora del host de la extensión para más información.", + "Kiota download failed. Try closing all Visual Studio Code windows and open only one. Check the extension host logs for more information.": "La descarga de Kiota ha fallado. Intente cerrar todas las ventanas en Visual Studio Code y abrir solamente una. Revise los registros de la extensión para más información.", "Downloading kiota...": "Descargando Kiota...", "Generating client...": "Generando cliente...", "Updating clients...": "Actualizando clientes...", diff --git a/vscode/microsoft-kiota/l10n/bundle.l10n.fr.json b/vscode/microsoft-kiota/l10n/bundle.l10n.fr.json index 93108caef0..d38a9ca7c0 100644 --- a/vscode/microsoft-kiota/l10n/bundle.l10n.fr.json +++ b/vscode/microsoft-kiota/l10n/bundle.l10n.fr.json @@ -23,7 +23,7 @@ "Enter an output path relative to the root of the project": "Entrez un chemin relatif à la racine du projet", "Pick a language": "Sélectionnez un langage", "Downloading kiota requires an internet connection. Please check your connection and try again.": "Télécharger Kiota nécessite une connexion Internet. Vérifiez votre connexion et réessayez.", - "Kiota download failed. Check the extension host logs for more information.": "Échec du téléchargement de Kiota. Vérifiez les journaux de l'hôte d'extension pour plus d'informations.", + "Kiota download failed. Try closing all Visual Studio Code windows and open only one. Check the extension host logs for more information.": "Échec du téléchargement de Kiota. Essayez de fermer toutes les fenêtres de Visual Studio Code et d'en ouvrir une seule. Vérifiez les journaux de l'hôte d'extension pour plus d'informations.", "Downloading kiota...": "Téléchargement de Kiota...", "Generating client...": "Génération du client...", "Updating clients...": "Mise à jour des clients...", diff --git a/vscode/microsoft-kiota/l10n/bundle.l10n.it.json b/vscode/microsoft-kiota/l10n/bundle.l10n.it.json index de7e8d200d..b9644dbb57 100644 --- a/vscode/microsoft-kiota/l10n/bundle.l10n.it.json +++ b/vscode/microsoft-kiota/l10n/bundle.l10n.it.json @@ -23,7 +23,7 @@ "Enter an output path relative to the root of the project": "Inserisci un path di output relativo alla root del progetto", "Pick a language": "Seleziona un linguaggio", "Downloading kiota requires an internet connection. Please check your connection and try again.": "Il download di kiota richiede una connessione internet. Controlla la tua connessione e riprova.", - "Kiota download failed. Check the extension host logs for more information.": "Il download di kiota è fallito. Controlla i log dell'host per maggiori informazioni.", + "Kiota download failed. Try closing all Visual Studio Code windows and open only one. Check the extension host logs for more information.": "Il download di Kiota è fallito. Prova a chiudere tutte le finestre di Visual Studio Code ed aprirne una sola. Controlla i log per maggiori informazioni.", "Downloading kiota...": "Download di kiota in corso...", "Generating client...": "Generazione del client in corso...", "Updating clients...": "Aggiornamento dei client in corso...", diff --git a/vscode/microsoft-kiota/l10n/bundle.l10n.ja.json b/vscode/microsoft-kiota/l10n/bundle.l10n.ja.json index 36cbb149fe..c4a9f9503a 100644 --- a/vscode/microsoft-kiota/l10n/bundle.l10n.ja.json +++ b/vscode/microsoft-kiota/l10n/bundle.l10n.ja.json @@ -24,7 +24,7 @@ "Enter an output path relative to the root of the project": "出力先をプロジェクトのルートからの相対パスで入力", "Pick a language": "言語を選択", "Downloading kiota requires an internet connection. Please check your connection and try again.": "Kiotaのダウンロードにはインターネット接続が必要です。インターネット接続を確認して再試行してください。", - "Kiota download failed. Check the extension host logs for more information.": "Kiotaのダウンロードに失敗しました。拡張機能のホストログを確認してください。", + "Kiota download failed. Try closing all Visual Studio Code windows and open only one. Check the extension host logs for more information.": "Kiotaのダウンロードに失敗しました。Visual Studio Code のすべてのウィンドウを閉じ、1つだけ開いてみてください。拡張機能のホストログを確認してください。", "Downloading kiota...": "Kiotaをダウンロード中...", "Generating client...": "クライアントを生成中...", "Updating clients...": "クライアントを更新中...", diff --git a/vscode/microsoft-kiota/l10n/bundle.l10n.pt.json b/vscode/microsoft-kiota/l10n/bundle.l10n.pt.json index f95c9d2727..16ff82a061 100644 --- a/vscode/microsoft-kiota/l10n/bundle.l10n.pt.json +++ b/vscode/microsoft-kiota/l10n/bundle.l10n.pt.json @@ -23,7 +23,7 @@ "Enter an output path relative to the root of the project": "Insira o caminho relativo da saída da raiz do projeto", "Pick a language": "Selecione uma linguagem", "Downloading kiota requires an internet connection. Please check your connection and try again.": "Para baixar o Kiota é necessário uma conexão de internet. Por favor, verifique sua conexão e tente novamente.", - "Kiota download failed. Check the extension host logs for more information.": "O download do Kiota falhou. Por favor, verifique os logs do host para mais informações.", + "Kiota download failed. Try closing all Visual Studio Code windows and open only one. Check the extension host logs for more information.": "O download do Kiota falhou. Tente fechar todas as janelas do Visual Studio Code e abrir somente uma. Verifique os logs do host da extensão para mais informações.", "Downloading kiota...": "Baixando o Kiota...", "Generating client...": "Gerando o cliente...", "Updating clients...": "Atualizando os clientes...", diff --git a/vscode/microsoft-kiota/l10n/bundle.l10n.ru.json b/vscode/microsoft-kiota/l10n/bundle.l10n.ru.json index 6acdbafde1..b6ee36942e 100644 --- a/vscode/microsoft-kiota/l10n/bundle.l10n.ru.json +++ b/vscode/microsoft-kiota/l10n/bundle.l10n.ru.json @@ -22,7 +22,7 @@ "Enter an output path relative to the root of the project": "Введите путь вывода относительно корня проекта", "Pick a language": "Выберите язык", "Downloading kiota requires an internet connection. Please check your connection and try again.": "Для загрузки Kiota требуется подключение к интернету. Пожалуйста, проверьте ваше подключение и попробуйте еще раз.", - "Kiota download failed. Check the extension host logs for more information.": "Скачивание Kiota не удалось. Для получения дополнительной информации проверьте журналы хост-процесс для расширений.", + "Kiota download failed. Try closing all Visual Studio Code windows and open only one. Check the extension host logs for more information.": "Загрузка Kiota не удалась. Попробуйте закрыть все окна Visual Studio Code и открыть только одно. Проверьте журналы хоста расширений для получения дополнительной информации.", "Downloading kiota...": "Идет загрузка Kiota...", "Generating client...": "Генерирование клиента...", "Updating clients...": "Обновление клиентов...", diff --git a/vscode/microsoft-kiota/l10n/bundle.l10n.sw.json b/vscode/microsoft-kiota/l10n/bundle.l10n.sw.json index f4acf37591..c42a14f1f8 100644 --- a/vscode/microsoft-kiota/l10n/bundle.l10n.sw.json +++ b/vscode/microsoft-kiota/l10n/bundle.l10n.sw.json @@ -23,7 +23,7 @@ "Enter an output path relative to the root of the project": "Ingiza eneo inayohusiana na mzizi wa mradi", "Pick a language": "Chagua lugha", "Downloading kiota requires an internet connection. Please check your connection and try again.": "Kupakua Kiota inahitaji muunganisho wa intaneti. Tafadhali angalia muunganisho wako kisha ujaribu tena.", - "Kiota download failed. Check the extension host logs for more information.": "Upakuaji wa Kiota haukufaulu. Angalia kumbukumbu za seva kwa maelezo zaidi..", + "Kiota download failed. Try closing all Visual Studio Code windows and open only one. Check the extension host logs for more information.": "Upakuaji wa Kiota haukufaulu. Jaribu kufunga dirisha zote za Visual Studio Code kisha ufungue moja tu. Angalia kumbukumbu za seva kwa maelezo zaidi", "Downloading kiota...": "Inapakua Kiota...", "Generating client...": "Inatengeneza mteja...", "Updating clients...": "Inasasisha wateja...", diff --git a/vscode/microsoft-kiota/l10n/bundle.l10n.tr.json b/vscode/microsoft-kiota/l10n/bundle.l10n.tr.json index 259edb2dfe..2f0dcb79b3 100644 --- a/vscode/microsoft-kiota/l10n/bundle.l10n.tr.json +++ b/vscode/microsoft-kiota/l10n/bundle.l10n.tr.json @@ -23,7 +23,7 @@ "Enter an output path relative to the root of the project": "Proje köküne göre bir çıktı yolu girin", "Pick a language": "Bir dil seçin", "Downloading kiota requires an internet connection. Please check your connection and try again.": "Kiota'nın indirilmesi bir internet bağlantısı gerektirir. Lütfen bağlantınızı kontrol edin ve tekrar deneyin.", - "Kiota download failed. Check the extension host logs for more information.": "Kiota indirme başarısız oldu. Daha fazla bilgi için uzantı log kayıtlarını kontrol edin.", + "Kiota download failed. Try closing all Visual Studio Code windows and open only one. Check the extension host logs for more information.": "Kiota indirme başarısız oldu. Daha fazla bilgi için uzantı log kayıtlarını kontrol edin.", "Downloading kiota...": "Kiota indiriliyor...", "Generating client...": "İstemci oluşturuluyor...", "Updating clients...": "İstemciler güncelleniyor...", diff --git a/vscode/microsoft-kiota/l10n/bundle.l10n.zh-cn.json b/vscode/microsoft-kiota/l10n/bundle.l10n.zh-cn.json index 2dfe6c5318..4a24b4c5c0 100644 --- a/vscode/microsoft-kiota/l10n/bundle.l10n.zh-cn.json +++ b/vscode/microsoft-kiota/l10n/bundle.l10n.zh-cn.json @@ -22,7 +22,7 @@ "Enter an output path relative to the root of the project": "请输入相对根路径的输出路径", "Pick a language": "请选择一个语言", "Downloading kiota requires an internet connection. Please check your connection and try again.": "下载Kiota需要网络连接。请检查您是否成功连接网络。", - "Kiota download failed. Check the extension host logs for more information.": "Kiota下载失败。请检查托管扩展记录。", + "Kiota download failed. Try closing all Visual Studio Code windows and open only one. Check the extension host logs for more information.": "Kiota 下载失败。请尝试关闭所有 Visual Studio Code 窗口并仅打开一个窗口。查看扩展主机日志以获取更多信息。", "Downloading kiota...": "正在下载Kiota...", "Generating client...": "正在生成客户端...", "Updating clients...": "正在更新客户端...", diff --git a/vscode/microsoft-kiota/package-lock.json b/vscode/microsoft-kiota/package-lock.json index 8cee8092a8..cb6f890bf0 100644 --- a/vscode/microsoft-kiota/package-lock.json +++ b/vscode/microsoft-kiota/package-lock.json @@ -1,14 +1,14 @@ { "name": "kiota", - "version": "1.10.100000002", + "version": "1.12.100000001", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "kiota", - "version": "1.10.100000002", + "version": "1.12.100000001", "dependencies": { - "@vscode/extension-telemetry": "^0.9.3", + "@vscode/extension-telemetry": "^0.9.5", "@vscode/l10n": "^0.0.18", "adm-zip": "^0.5.12", "is-online": "^10.0.0", @@ -28,7 +28,7 @@ "mocha": "^10.3.0", "ts-loader": "^9.5.1", "typescript": "^5.4.2", - "webpack": "^5.90.3", + "webpack": "^5.91.0", "webpack-cli": "^5.1.4" }, "engines": { @@ -733,13 +733,13 @@ "dev": true }, "node_modules/@vscode/extension-telemetry": { - "version": "0.9.3", - "resolved": "https://registry.npmjs.org/@vscode/extension-telemetry/-/extension-telemetry-0.9.3.tgz", - "integrity": "sha512-F1to8DhI5wP30/gqUDeX5LA/eyUuGbGgDMbSuVUJeER+7byehcpsYW2ySjVDHlfXqwGIvMd+QW9g+p0zWaFS3w==", + "version": "0.9.5", + "resolved": "https://registry.npmjs.org/@vscode/extension-telemetry/-/extension-telemetry-0.9.5.tgz", + "integrity": "sha512-9cC84JDBnofbmHpGU0DnmqLHgN2zNF85YEjrosCizLpXSVzsLiamWz0HlHCjZg5nNXei5tBGmYUQ6/vU641o8w==", "dependencies": { - "@microsoft/1ds-core-js": "^4.1.0", - "@microsoft/1ds-post-js": "^4.1.0", - "@microsoft/applicationinsights-web-basic": "^3.1.0" + "@microsoft/1ds-core-js": "^4.0.6", + "@microsoft/1ds-post-js": "^4.0.6", + "@microsoft/applicationinsights-web-basic": "^3.0.8" }, "engines": { "vscode": "^1.75.0" @@ -766,9 +766,9 @@ } }, "node_modules/@webassemblyjs/ast": { - "version": "1.11.6", - "resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.11.6.tgz", - "integrity": "sha512-IN1xI7PwOvLPgjcf180gC1bqn3q/QaOCwYUahIOhbYUu8KA/3tw2RT/T0Gidi1l7Hhj5D/INhJxiICObqpMu4Q==", + "version": "1.12.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.12.1.tgz", + "integrity": "sha512-EKfMUOPRRUTy5UII4qJDGPpqfwjOmZ5jeGFwid9mnoqIFK+e0vqoi1qH56JpmZSzEL53jKnNzScdmftJyG5xWg==", "dev": true, "dependencies": { "@webassemblyjs/helper-numbers": "1.11.6", @@ -788,9 +788,9 @@ "dev": true }, "node_modules/@webassemblyjs/helper-buffer": { - "version": "1.11.6", - "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-buffer/-/helper-buffer-1.11.6.tgz", - "integrity": "sha512-z3nFzdcp1mb8nEOFFk8DrYLpHvhKC3grJD2ardfKOzmbmJvEf/tPIqCY+sNcwZIY8ZD7IkB2l7/pqhUhqm7hLA==", + "version": "1.12.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-buffer/-/helper-buffer-1.12.1.tgz", + "integrity": "sha512-nzJwQw99DNDKr9BVCOZcLuJJUlqkJh+kVzVl6Fmq/tI5ZtEyWT1KZMyOXltXLZJmDtvLCDgwsyrkohEtopTXCw==", "dev": true }, "node_modules/@webassemblyjs/helper-numbers": { @@ -811,15 +811,15 @@ "dev": true }, "node_modules/@webassemblyjs/helper-wasm-section": { - "version": "1.11.6", - "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-section/-/helper-wasm-section-1.11.6.tgz", - "integrity": "sha512-LPpZbSOwTpEC2cgn4hTydySy1Ke+XEu+ETXuoyvuyezHO3Kjdu90KK95Sh9xTbmjrCsUwvWwCOQQNta37VrS9g==", + "version": "1.12.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-section/-/helper-wasm-section-1.12.1.tgz", + "integrity": "sha512-Jif4vfB6FJlUlSbgEMHUyk1j234GTNG9dBJ4XJdOySoj518Xj0oGsNi59cUQF4RRMS9ouBUxDDdyBVfPTypa5g==", "dev": true, "dependencies": { - "@webassemblyjs/ast": "1.11.6", - "@webassemblyjs/helper-buffer": "1.11.6", + "@webassemblyjs/ast": "1.12.1", + "@webassemblyjs/helper-buffer": "1.12.1", "@webassemblyjs/helper-wasm-bytecode": "1.11.6", - "@webassemblyjs/wasm-gen": "1.11.6" + "@webassemblyjs/wasm-gen": "1.12.1" } }, "node_modules/@webassemblyjs/ieee754": { @@ -847,28 +847,28 @@ "dev": true }, "node_modules/@webassemblyjs/wasm-edit": { - "version": "1.11.6", - "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-edit/-/wasm-edit-1.11.6.tgz", - "integrity": "sha512-Ybn2I6fnfIGuCR+Faaz7YcvtBKxvoLV3Lebn1tM4o/IAJzmi9AWYIPWpyBfU8cC+JxAO57bk4+zdsTjJR+VTOw==", + "version": "1.12.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-edit/-/wasm-edit-1.12.1.tgz", + "integrity": "sha512-1DuwbVvADvS5mGnXbE+c9NfA8QRcZ6iKquqjjmR10k6o+zzsRVesil54DKexiowcFCPdr/Q0qaMgB01+SQ1u6g==", "dev": true, "dependencies": { - "@webassemblyjs/ast": "1.11.6", - "@webassemblyjs/helper-buffer": "1.11.6", + "@webassemblyjs/ast": "1.12.1", + "@webassemblyjs/helper-buffer": "1.12.1", "@webassemblyjs/helper-wasm-bytecode": "1.11.6", - "@webassemblyjs/helper-wasm-section": "1.11.6", - "@webassemblyjs/wasm-gen": "1.11.6", - "@webassemblyjs/wasm-opt": "1.11.6", - "@webassemblyjs/wasm-parser": "1.11.6", - "@webassemblyjs/wast-printer": "1.11.6" + "@webassemblyjs/helper-wasm-section": "1.12.1", + "@webassemblyjs/wasm-gen": "1.12.1", + "@webassemblyjs/wasm-opt": "1.12.1", + "@webassemblyjs/wasm-parser": "1.12.1", + "@webassemblyjs/wast-printer": "1.12.1" } }, "node_modules/@webassemblyjs/wasm-gen": { - "version": "1.11.6", - "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-gen/-/wasm-gen-1.11.6.tgz", - "integrity": "sha512-3XOqkZP/y6B4F0PBAXvI1/bky7GryoogUtfwExeP/v7Nzwo1QLcq5oQmpKlftZLbT+ERUOAZVQjuNVak6UXjPA==", + "version": "1.12.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-gen/-/wasm-gen-1.12.1.tgz", + "integrity": "sha512-TDq4Ojh9fcohAw6OIMXqiIcTq5KUXTGRkVxbSo1hQnSy6lAM5GSdfwWeSxpAo0YzgsgF182E/U0mDNhuA0tW7w==", "dev": true, "dependencies": { - "@webassemblyjs/ast": "1.11.6", + "@webassemblyjs/ast": "1.12.1", "@webassemblyjs/helper-wasm-bytecode": "1.11.6", "@webassemblyjs/ieee754": "1.11.6", "@webassemblyjs/leb128": "1.11.6", @@ -876,24 +876,24 @@ } }, "node_modules/@webassemblyjs/wasm-opt": { - "version": "1.11.6", - "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-opt/-/wasm-opt-1.11.6.tgz", - "integrity": "sha512-cOrKuLRE7PCe6AsOVl7WasYf3wbSo4CeOk6PkrjS7g57MFfVUF9u6ysQBBODX0LdgSvQqRiGz3CXvIDKcPNy4g==", + "version": "1.12.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-opt/-/wasm-opt-1.12.1.tgz", + "integrity": "sha512-Jg99j/2gG2iaz3hijw857AVYekZe2SAskcqlWIZXjji5WStnOpVoat3gQfT/Q5tb2djnCjBtMocY/Su1GfxPBg==", "dev": true, "dependencies": { - "@webassemblyjs/ast": "1.11.6", - "@webassemblyjs/helper-buffer": "1.11.6", - "@webassemblyjs/wasm-gen": "1.11.6", - "@webassemblyjs/wasm-parser": "1.11.6" + "@webassemblyjs/ast": "1.12.1", + "@webassemblyjs/helper-buffer": "1.12.1", + "@webassemblyjs/wasm-gen": "1.12.1", + "@webassemblyjs/wasm-parser": "1.12.1" } }, "node_modules/@webassemblyjs/wasm-parser": { - "version": "1.11.6", - "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-parser/-/wasm-parser-1.11.6.tgz", - "integrity": "sha512-6ZwPeGzMJM3Dqp3hCsLgESxBGtT/OeCvCZ4TA1JUPYgmhAx38tTPR9JaKy0S5H3evQpO/h2uWs2j6Yc/fjkpTQ==", + "version": "1.12.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-parser/-/wasm-parser-1.12.1.tgz", + "integrity": "sha512-xikIi7c2FHXysxXe3COrVUPSheuBtpcfhbpFj4gmu7KRLYOzANztwUU0IbsqvMqzuNK2+glRGWCEqZo1WCLyAQ==", "dev": true, "dependencies": { - "@webassemblyjs/ast": "1.11.6", + "@webassemblyjs/ast": "1.12.1", "@webassemblyjs/helper-api-error": "1.11.6", "@webassemblyjs/helper-wasm-bytecode": "1.11.6", "@webassemblyjs/ieee754": "1.11.6", @@ -902,12 +902,12 @@ } }, "node_modules/@webassemblyjs/wast-printer": { - "version": "1.11.6", - "resolved": "https://registry.npmjs.org/@webassemblyjs/wast-printer/-/wast-printer-1.11.6.tgz", - "integrity": "sha512-JM7AhRcE+yW2GWYaKeHL5vt4xqee5N2WcezptmgyhNS+ScggqcT1OtXykhAb13Sn5Yas0j2uv9tHgrjwvzAP4A==", + "version": "1.12.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wast-printer/-/wast-printer-1.12.1.tgz", + "integrity": "sha512-+X4WAlOisVWQMikjbcvY2e0rwPsKQ9F688lksZhBcPycBBuii3O7m8FACbDMWDojpAqvjIncrG8J0XHKyQfVeA==", "dev": true, "dependencies": { - "@webassemblyjs/ast": "1.11.6", + "@webassemblyjs/ast": "1.12.1", "@xtuc/long": "4.2.2" } }, @@ -1614,9 +1614,9 @@ "dev": true }, "node_modules/enhanced-resolve": { - "version": "5.15.0", - "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.15.0.tgz", - "integrity": "sha512-LXYT42KJ7lpIKECr2mAXIaMldcNCh/7E0KBKOu4KSfkHmP+mZmSs+8V5gBAqisWBy0OO4W5Oyys0GO1Y8KtdKg==", + "version": "5.16.0", + "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.16.0.tgz", + "integrity": "sha512-O+QWCviPNSSLAD9Ucn8Awv+poAkqn3T1XY5/N7kR7rQO9yfSGWkYZDwpJ+iKF7B8rxaQKWngSqACpgzeapSyoA==", "dev": true, "dependencies": { "graceful-fs": "^4.2.4", @@ -3989,9 +3989,9 @@ } }, "node_modules/watchpack": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.4.0.tgz", - "integrity": "sha512-Lcvm7MGST/4fup+ifyKi2hjyIAwcdI4HRgtvTpIUxBRhB+RFtUh8XtDOxUfctVCnhVi+QQj49i91OyvzkJl6cg==", + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.4.1.tgz", + "integrity": "sha512-8wrBCMtVhqcXP2Sup1ctSkga6uc2Bx0IIvKyT7yTFier5AXHooSI+QyQQAtTb7+E0IUCCKyTFmXqdqgum2XWGg==", "dev": true, "dependencies": { "glob-to-regexp": "^0.4.1", @@ -4002,26 +4002,26 @@ } }, "node_modules/webpack": { - "version": "5.90.3", - "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.90.3.tgz", - "integrity": "sha512-h6uDYlWCctQRuXBs1oYpVe6sFcWedl0dpcVaTf/YF67J9bKvwJajFulMVSYKHrksMB3I/pIagRzDxwxkebuzKA==", + "version": "5.91.0", + "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.91.0.tgz", + "integrity": "sha512-rzVwlLeBWHJbmgTC/8TvAcu5vpJNII+MelQpylD4jNERPwpBJOE2lEcko1zJX3QJeLjTTAnQxn/OJ8bjDzVQaw==", "dev": true, "dependencies": { "@types/eslint-scope": "^3.7.3", "@types/estree": "^1.0.5", - "@webassemblyjs/ast": "^1.11.5", - "@webassemblyjs/wasm-edit": "^1.11.5", - "@webassemblyjs/wasm-parser": "^1.11.5", + "@webassemblyjs/ast": "^1.12.1", + "@webassemblyjs/wasm-edit": "^1.12.1", + "@webassemblyjs/wasm-parser": "^1.12.1", "acorn": "^8.7.1", "acorn-import-assertions": "^1.9.0", "browserslist": "^4.21.10", "chrome-trace-event": "^1.0.2", - "enhanced-resolve": "^5.15.0", + "enhanced-resolve": "^5.16.0", "es-module-lexer": "^1.2.1", "eslint-scope": "5.1.1", "events": "^3.2.0", "glob-to-regexp": "^0.4.1", - "graceful-fs": "^4.2.9", + "graceful-fs": "^4.2.11", "json-parse-even-better-errors": "^2.3.1", "loader-runner": "^4.2.0", "mime-types": "^2.1.27", @@ -4029,7 +4029,7 @@ "schema-utils": "^3.2.0", "tapable": "^2.1.1", "terser-webpack-plugin": "^5.3.10", - "watchpack": "^2.4.0", + "watchpack": "^2.4.1", "webpack-sources": "^3.2.3" }, "bin": { diff --git a/vscode/microsoft-kiota/package.json b/vscode/microsoft-kiota/package.json index b54e9f2687..0bcc90153a 100644 --- a/vscode/microsoft-kiota/package.json +++ b/vscode/microsoft-kiota/package.json @@ -3,8 +3,8 @@ "displayName": "Microsoft Kiota", "publisher": "ms-graph", "description": "Client generator for HTTP REST APIs described by OpenAPI which helps eliminate the need to take a dependency on a different API client for every API that you need to call, as well as limiting the generation to the exact API surface area you're interested in, thanks to a filtering capability.", - "version": "1.10.100000002", - "kiotaVersion": "1.10.1", + "version": "1.12.100000001", + "kiotaVersion": "1.12.0", "telemetryInstrumentationKey": "4c6357e0-daf9-42b5-bdfb-67878f8957b5", "icon": "images/logo.png", "engines": { @@ -435,11 +435,11 @@ "mocha": "^10.3.0", "ts-loader": "^9.5.1", "typescript": "^5.4.2", - "webpack": "^5.90.3", + "webpack": "^5.91.0", "webpack-cli": "^5.1.4" }, "dependencies": { - "@vscode/extension-telemetry": "^0.9.3", + "@vscode/extension-telemetry": "^0.9.5", "@vscode/l10n": "^0.0.18", "adm-zip": "^0.5.12", "is-online": "^10.0.0", @@ -450,23 +450,23 @@ "runtimeDependencies": [ { "platformId": "win-x64", - "sha256": "F14DA204DBB513B12995C006DD4A356C8498EFF087BA77EE84E06C18AE92A947" + "sha256": "04884ED264534CCE1708F0377809A98BFBE73F1B916432B71845CFF426B4E15D" }, { "platformId": "win-x86", - "sha256": "1E55DDEBC4EC8AC8B527C7681FD342A2CFB74150914DD1E9669B84DAF26E18D5" + "sha256": "9324A3B58889B0DD123B478608E6A59FED3147B3268C4EF37F172BC9517B1233" }, { "platformId": "linux-x64", - "sha256": "311F765AEC73477501B1C6EA97C0EAF108144318CB1C7C39D20B3CEE4C5DF848" + "sha256": "C093782E42DFA98574A1503D27F661F54F1C8CA92B66F6ED7B9DF475447E1769" }, { "platformId": "osx-x64", - "sha256": "82843F91BEC078C9344BAFFE7D8B7FB87BDAD7160329AF221BCEBA2C10DD0B50" + "sha256": "7911E277474EFF71D00C9983A9F3E43460F5C3C3FBB565CFE069854BA4069FCD" }, { "platformId": "osx-arm64", - "sha256": "FD8EE5E60432E2885B4DE0E650D92829EE5EA4D20C50E7CB7D3E7B2FCDCDCB9B" + "sha256": "032AFBCF63FFF1C21215277E5EAFDD1909E1EFE5213B15F52ED4BBBDF3695C0A" } ] } diff --git a/vscode/microsoft-kiota/src/kiotaInstall.ts b/vscode/microsoft-kiota/src/kiotaInstall.ts index 82e8ed903e..25e84c90e5 100644 --- a/vscode/microsoft-kiota/src/kiotaInstall.ts +++ b/vscode/microsoft-kiota/src/kiotaInstall.ts @@ -6,16 +6,34 @@ import * as admZip from 'adm-zip'; import * as vscode from "vscode"; import isOnline from 'is-online'; + +const kiotaInstallStatusKey = "kiotaInstallStatus"; +const installDelayInMs = 30000; // 30 seconds +async function runIfNotLocked(context: vscode.ExtensionContext, action: () => Promise) { + const installStartTimeStamp = context.globalState.get(kiotaInstallStatusKey); + const currentTimeStamp = new Date().getTime(); + if (!installStartTimeStamp || (currentTimeStamp - installStartTimeStamp) > installDelayInMs) { + //locking the context to prevent multiple downloads across multiple instances of vscode + //overriding after 30 seconds to prevent stale locks + await context.globalState.update(kiotaInstallStatusKey, currentTimeStamp); + try { + await action(); + } finally { + await context.globalState.update(kiotaInstallStatusKey, undefined); + } + } +} export async function ensureKiotaIsPresent(context: vscode.ExtensionContext) { const runtimeDependencies = getRuntimeDependenciesPackages(context); const currentPlatform = getCurrentPlatform(); const installPath = getKiotaPathInternal(context, false); if (installPath) { - if (!fs.existsSync(installPath)) { + if (!fs.existsSync(installPath) || fs.readdirSync(installPath).length === 0) { await vscode.window.withProgress({ location: vscode.ProgressLocation.Notification, cancellable: false, title: vscode.l10n.t("Downloading kiota...") + }, async (progress, _) => { const online = await isOnline(); if (!online) { @@ -24,29 +42,31 @@ export async function ensureKiotaIsPresent(context: vscode.ExtensionContext) { ); return; } - try { - const packageToInstall = runtimeDependencies.find((p) => p.platformId === currentPlatform); - if (!packageToInstall) { - throw new Error("Could not find package to install"); - } - fs.mkdirSync(installPath, { recursive: true }); - const zipFilePath = `${installPath}.zip`; - await downloadFileFromUrl(getDownloadUrl(context, currentPlatform), zipFilePath); - if (await doesFileHashMatch(zipFilePath, packageToInstall.sha256)) { - unzipFile(zipFilePath, installPath); - const kiotaPath = getKiotaPathInternal(context); - if ((currentPlatform.startsWith(linuxPlatform) || currentPlatform.startsWith(osxPlatform)) && kiotaPath) { - makeExecutable(kiotaPath); + await runIfNotLocked(context, async () => { + try { + const packageToInstall = runtimeDependencies.find((p) => p.platformId === currentPlatform); + if (!packageToInstall) { + throw new Error("Could not find package to install"); + } + fs.mkdirSync(installPath, { recursive: true }); + const zipFilePath = `${installPath}.zip`; + await downloadFileFromUrl(getDownloadUrl(context, currentPlatform), zipFilePath); + if (await doesFileHashMatch(zipFilePath, packageToInstall.sha256)) { + unzipFile(zipFilePath, installPath); + const kiotaPath = getKiotaPathInternal(context); + if ((currentPlatform.startsWith(linuxPlatform) || currentPlatform.startsWith(osxPlatform)) && kiotaPath) { + makeExecutable(kiotaPath); + } + } else { + throw new Error("Hash mismatch"); + } + } catch(error) { + await vscode.window.showErrorMessage( + vscode.l10n.t("Kiota download failed. Try closing all Visual Studio Code windows and open only one. Check the extension host logs for more information.") + ); + fs.rmdirSync(installPath, { recursive: true }); } - } else { - throw new Error("Hash mismatch"); - } - } catch(error) { - await vscode.window.showErrorMessage( - vscode.l10n.t("Kiota download failed. Check the extension host logs for more information.") - ); - fs.rmdirSync(installPath, { recursive: true }); - } + }); }); } }