diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index cd48e09a15f..fffb7fd5290 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -2,7 +2,7 @@ lockfileVersion: 5.4 specifiers: '@autorest/codemodel': ~4.19.3 - '@autorest/extension-base': ~3.3.2 + '@autorest/extension-base': ~3.5.2 '@azure-tools/async-io': ~3.0.0 '@azure-tools/codegen': ~2.5.276 '@azure-tools/codegen-csharp': ~3.0.0 @@ -18,7 +18,7 @@ specifiers: '@types/xmlbuilder': 0.0.34 '@typescript-eslint/eslint-plugin': ~5.29.0 '@typescript-eslint/parser': ~5.29.0 - autorest: ~3.0.6118 + autorest: ~3.6.3 ejs: ~3.1.8 eslint: ~8.12.0 js-yaml: 3.13.1 @@ -29,7 +29,7 @@ specifiers: dependencies: '@autorest/codemodel': 4.19.3 - '@autorest/extension-base': 3.3.2 + '@autorest/extension-base': 3.5.2 '@azure-tools/async-io': 3.0.254 '@azure-tools/codegen': 2.5.294 '@azure-tools/codegen-csharp': 3.0.264 @@ -45,7 +45,7 @@ dependencies: '@types/xmlbuilder': 0.0.34 '@typescript-eslint/eslint-plugin': 5.29.0_ifvwzowahspquf7ob7ibdbwr3q '@typescript-eslint/parser': 5.29.0_bxxcq4gtiti7cn2tgh35u7ub6a - autorest: 3.0.6339 + autorest: 3.6.3 ejs: 3.1.9 eslint: 8.12.0 js-yaml: 3.13.1 @@ -64,11 +64,11 @@ packages: js-yaml: 4.0.0 dev: false - /@autorest/extension-base/3.3.2: - resolution: {integrity: sha512-kBTusd0GvjmBhN3NypCm/WxpmIxZL2/qCfI5sIYz7ICl7BW6LCGpM3yO1MBQY/pC3VGUT/ypzeW8+X691uh7fA==} + /@autorest/extension-base/3.5.2: + resolution: {integrity: sha512-brpRtQ34mo/SZPTWrOUYvDHOKbvDa9eX5N15qd0OGLX8q3y29nXjhokMVoink4w1jW+8p2KXy2emMIZL14s+HQ==} engines: {node: '>=12.0.0'} dependencies: - '@azure-tools/codegen': 2.8.0 + '@azure-tools/codegen': 2.9.2 js-yaml: 4.0.0 vscode-jsonrpc: 3.6.2 dev: false @@ -107,15 +107,6 @@ packages: semver: 5.7.1 dev: false - /@azure-tools/codegen/2.8.0: - resolution: {integrity: sha512-HzIWjWzzjCAiUr8uXH1EfeCiC9Gln5YPTbJyfPQCBQeXAQIMRFo1IabFnBXhJpuRl7R11vpt4THELydYZLbalw==} - engines: {node: '>=12.0.0'} - dependencies: - '@azure-tools/async-io': 3.0.254 - js-yaml: 4.0.0 - semver: 5.7.1 - dev: false - /@azure-tools/codegen/2.9.2: resolution: {integrity: sha512-brVLyffOtPiEijYYBYgV+4q7IyAfqXIec7XbdEqvv7As6SeEdq5WtbtN9N0LdGVHDWtEfc+JArwIx9aYGFdMUg==} engines: {node: '>=12.0.0'} @@ -532,9 +523,9 @@ packages: resolution: {integrity: sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==} dev: false - /autorest/3.0.6339: - resolution: {integrity: sha512-OCCmAxi5gUnh7yPho5A4n8kDrnp5uz4DdFrqwMmp/bU5DVByIdVwrWERlB7EnCFqQ9jz86oZtsjy91B07+zLnw==} - engines: {node: '>=10.13.0'} + /autorest/3.6.3: + resolution: {integrity: sha512-j/Axwk9bniifTNtBLYVxfQZGQIGPKljFaCQCBWOiybVar2j3tkHP1btiC4a/t9pAJXY6IaFgWctoPM3G/Puhyg==} + engines: {node: '>=12.0.0'} hasBin: true requiresBuild: true dev: false @@ -3062,12 +3053,12 @@ packages: dev: false file:projects/powershell.tgz: - resolution: {integrity: sha512-u8pHTS99cxk4n2v5B7/KDyx577szjkt8TXSsWU1xEGvheQSXI3hfsb5mYklZXMSFmaHi399ml7NDU64GUhsDHw==, tarball: file:projects/powershell.tgz} + resolution: {integrity: sha512-4RBOmwKyWq5asrQNDM/ZIF9QnKpoOh69Cp9gnPK2A31YdXEaGsCoQafPSCz4l2OtyvO9k/0Zt0ZvVpUPsfUIrg==, tarball: file:projects/powershell.tgz} name: '@rush-temp/powershell' version: 0.0.0 dependencies: '@autorest/codemodel': 4.19.3 - '@autorest/extension-base': 3.3.2 + '@autorest/extension-base': 3.5.2 '@azure-tools/async-io': 3.0.254 '@azure-tools/autorest-extension-base': 3.1.267 '@azure-tools/codegen': 2.5.294 @@ -3084,7 +3075,7 @@ packages: '@types/xmlbuilder': 0.0.34 '@typescript-eslint/eslint-plugin': 5.29.0_ifvwzowahspquf7ob7ibdbwr3q '@typescript-eslint/parser': 5.29.0_bxxcq4gtiti7cn2tgh35u7ub6a - autorest: 3.0.6339 + autorest: 3.6.3 ejs: 3.1.9 eslint: 8.12.0 js-yaml: 3.13.1 diff --git a/powershell/generators/gitignore.ts b/powershell/generators/gitignore.ts index 15afb511bbd..d4dd530ff85 100644 --- a/powershell/generators/gitignore.ts +++ b/powershell/generators/gitignore.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { Host } from '@autorest/extension-base'; +import { AutorestExtensionHost as Host } from '@autorest/extension-base'; import { Project } from '../internal/project'; export async function generateGitIgnore(project: Project) { diff --git a/powershell/generators/nuspec.ts b/powershell/generators/nuspec.ts index a6e1b756cec..a290cb054b4 100644 --- a/powershell/generators/nuspec.ts +++ b/powershell/generators/nuspec.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { Host } from '@autorest/extension-base'; +import { AutorestExtensionHost as Host } from '@autorest/extension-base'; import { Project } from '../internal/project'; function removeCd(path: string): string { diff --git a/powershell/generators/psm1.custom.ts b/powershell/generators/psm1.custom.ts index e81491821fe..68ad4aa17f5 100644 --- a/powershell/generators/psm1.custom.ts +++ b/powershell/generators/psm1.custom.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { Host } from '@autorest/extension-base'; +import { AutorestExtensionHost as Host } from '@autorest/extension-base'; import { Project } from '../internal/project'; import { PSScriptFile } from '../file-formats/psscript-file'; import { relative } from 'path'; diff --git a/powershell/generators/psm1.internal.ts b/powershell/generators/psm1.internal.ts index b86e7ec772b..98829f795fb 100644 --- a/powershell/generators/psm1.internal.ts +++ b/powershell/generators/psm1.internal.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { Host } from '@autorest/extension-base'; +import { AutorestExtensionHost as Host } from '@autorest/extension-base'; import { Project } from '../internal/project'; import { PSScriptFile } from '../file-formats/psscript-file'; import { relative } from 'path'; diff --git a/powershell/internal/project.ts b/powershell/internal/project.ts index dd1cf0019c8..37685132eae 100644 --- a/powershell/internal/project.ts +++ b/powershell/internal/project.ts @@ -18,7 +18,7 @@ import { pwshHeaderText } from '../utils/powershell-comment'; import { ModuleNamespace } from '../module/module-namespace'; import { CmdletNamespace } from '../cmdlets/namespace'; -import { Host } from '@autorest/extension-base'; +import { AutorestExtensionHost as Host } from '@autorest/extension-base'; import { codemodel, PropertyDetails, @@ -236,7 +236,7 @@ export class Project extends codeDomProject { pwshLicenseHeader ? pwshHeaderText( pwshLicenseHeader, - await this.service.GetValue('header-definitions') + await this.service.getValue('header-definitions') ) : this.license, '#' @@ -249,7 +249,7 @@ export class Project extends codeDomProject { pwshLicenseHeader ? pwshHeaderText( pwshLicenseHeader, - await this.service.GetValue('header-definitions') + await this.service.getValue('header-definitions') ) : this.license, '//' diff --git a/powershell/internal/state.ts b/powershell/internal/state.ts index 614b1b57126..3dd5a4fed12 100644 --- a/powershell/internal/state.ts +++ b/powershell/internal/state.ts @@ -5,7 +5,7 @@ import { codemodel } from '@azure-tools/codemodel-v3'; -import { Host, JsonPath, Session } from '@autorest/extension-base'; +import { AutorestExtensionHost as Host, JsonPointerSegments as JsonPath, Session } from '@autorest/extension-base'; import { Project } from './project'; import { DeepPartial } from '@azure-tools/codegen'; import { PwshModel } from '../utils/PwshModel'; diff --git a/powershell/llcsharp/generator.ts b/powershell/llcsharp/generator.ts index a3eda923a04..46aa4c85fdb 100644 --- a/powershell/llcsharp/generator.ts +++ b/powershell/llcsharp/generator.ts @@ -5,7 +5,7 @@ import { codeModelSchema } from '@autorest/codemodel'; import { Model } from './code-model'; -import { Host, JsonPath, Session, startSession } from '@autorest/extension-base'; +import { AutorestExtensionHost as Host, JsonPointerSegments as JsonPath, Session, startSession } from '@autorest/extension-base'; import { Project } from './project'; import { Dictionary } from '@azure-tools/linq'; diff --git a/powershell/llcsharp/project.ts b/powershell/llcsharp/project.ts index fc2ae3c6745..93635cba38a 100644 --- a/powershell/llcsharp/project.ts +++ b/powershell/llcsharp/project.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { Host } from '@autorest/extension-base'; +import { AutorestExtensionHost as Host } from '@autorest/extension-base'; import { items, values, keys, Dictionary, length } from '@azure-tools/linq'; import { Project as codeDomProject } from '@azure-tools/codegen-csharp'; diff --git a/powershell/llcsharp/schema/schema-resolver.ts b/powershell/llcsharp/schema/schema-resolver.ts index 483c18e8bb6..2a206c21b35 100644 --- a/powershell/llcsharp/schema/schema-resolver.ts +++ b/powershell/llcsharp/schema/schema-resolver.ts @@ -26,7 +26,7 @@ import { Uuid } from './Uuid'; import { EnhancedTypeDeclaration } from './extended-type-declaration'; import { PwshModel } from '../../utils/PwshModel'; import { ModelState } from '../../utils/model-state'; -import { Channel, Host, Session, startSession } from '@autorest/extension-base'; +import { Channel, AutorestExtensionHost as Host, Session, startSession } from '@autorest/extension-base'; import { schemaHasEnum } from '../validations'; import { Password } from './password'; diff --git a/powershell/package.json b/powershell/package.json index 84b06fbef7f..e1996ec2afc 100644 --- a/powershell/package.json +++ b/powershell/package.json @@ -50,7 +50,7 @@ "@typescript-eslint/eslint-plugin": "~5.29.0", "@typescript-eslint/parser": "~5.29.0", "@microsoft.azure/autorest.testserver": "~2.9.3", - "autorest": "~3.0.6118", + "autorest": "~3.6.3", "eslint": "~8.12.0" }, "dependencies": { @@ -58,7 +58,7 @@ "@azure-tools/codegen": "~2.5.276", "@azure-tools/codegen-csharp": "~3.0.0", "@azure-tools/codemodel-v3": "~3.1.0", - "@autorest/extension-base": "~3.3.2", + "@autorest/extension-base": "~3.5.2", "@autorest/codemodel": "~4.19.3", "@azure-tools/linq": "~3.1.0", "@azure-tools/tasks": "~3.0.0", diff --git a/powershell/plugins/add-azure-completers-v2.ts b/powershell/plugins/add-azure-completers-v2.ts index b9a3e15d375..3b1ddf7a067 100644 --- a/powershell/plugins/add-azure-completers-v2.ts +++ b/powershell/plugins/add-azure-completers-v2.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import { values } from '@azure-tools/linq'; -import { Host } from '@autorest/extension-base'; +import { AutorestExtensionHost as Host } from '@autorest/extension-base'; import { PwshModel } from '../utils/PwshModel'; import { ModelState } from '../utils/model-state'; import { serialize } from '@azure-tools/codegen'; @@ -46,5 +46,5 @@ async function tweakModel(state: State): Promise { export async function addCompleterV2(service: Host) { const state = await new ModelState(service).init(); - await service.WriteFile('code-model-v4-add-azure-completers-v2.yaml', serialize(await tweakModel(state)), undefined, 'code-model-v4'); + await service.writeFile({filename: 'code-model-v4-add-azure-completers-v2.yaml', content: serialize(await tweakModel(state)), sourceMap: undefined, artifactType: 'code-model-v4'}); } diff --git a/powershell/plugins/create-commands-v2.ts b/powershell/plugins/create-commands-v2.ts index fc8505e1a6c..4caaccb4434 100644 --- a/powershell/plugins/create-commands-v2.ts +++ b/powershell/plugins/create-commands-v2.ts @@ -7,7 +7,7 @@ import { HttpMethod, codeModelSchema, CodeModel, ObjectSchema, GroupSchema, isOb import { deconstruct, fixLeadingNumber, pascalCase, EnglishPluralizationService, fail, removeSequentialDuplicates, serialize, includeXDash } from '@azure-tools/codegen'; import { items, values, keys, Dictionary, length } from '@azure-tools/linq'; import { Schema } from '../llcsharp/exports'; -import { Channel, Host, Session, startSession } from '@autorest/extension-base'; +import { Channel, AutorestExtensionHost as Host, Session, startSession } from '@autorest/extension-base'; import { Lazy } from '@azure-tools/tasks'; import { clone } from '@azure-tools/linq'; import { verbs } from '../internal/verbs'; @@ -617,7 +617,7 @@ export async function createCommandsV2(service: Host) { //const session = await startSession(service, {}, codeModelSchema); //const result = tweakModelV2(session); const state = await new ModelState(service).init(); - await service.WriteFile('code-model-v4-createcommands-v2.yaml', serialize(await (await new Inferrer(state).init()).createCommands()), undefined, 'code-model-v4'); + await service.writeFile({ filename: 'code-model-v4-createcommands-v2.yaml', content: serialize(await (await new Inferrer(state).init()).createCommands()), sourceMap: undefined, artifactType: 'code-model-v4'}); // return processCodeModel(async (state) => { // return await (await new Inferrer(state).init()).createCommands(); diff --git a/powershell/plugins/cs-namer-v2.ts b/powershell/plugins/cs-namer-v2.ts index 514c75367a9..83c2c226947 100644 --- a/powershell/plugins/cs-namer-v2.ts +++ b/powershell/plugins/cs-namer-v2.ts @@ -8,7 +8,7 @@ import { camelCase, deconstruct, excludeXDash, fixLeadingNumber, pascalCase, low import { items, values, keys, Dictionary, length } from '@azure-tools/linq'; import { System } from '@azure-tools/codegen-csharp'; -import { Channel, Host, Session, startSession } from '@autorest/extension-base'; +import { Channel, AutorestExtensionHost as Host, Session, startSession } from '@autorest/extension-base'; import { SchemaDetails } from '../llcsharp/code-model'; import { SchemaDefinitionResolver } from '../llcsharp/schema/schema-resolver'; import { PwshModel } from '../utils/PwshModel'; @@ -271,6 +271,6 @@ export async function csnamerV2(service: Host) { //const session = await startSession(service, {}, codeModelSchema); //const result = tweakModelV2(session); const state = await new ModelState(service).init(); - await service.WriteFile('code-model-v4-csnamer-v2.yaml', serialize(await nameStuffRight(state)), undefined, 'code-model-v4'); + await service.writeFile({ filename: 'code-model-v4-csnamer-v2.yaml', content: serialize(await nameStuffRight(state)), sourceMap: undefined, artifactType: 'code-model-v4'}); } diff --git a/powershell/plugins/llcsharp-v2.ts b/powershell/plugins/llcsharp-v2.ts index 76e35872960..eab78c2dc39 100644 --- a/powershell/plugins/llcsharp-v2.ts +++ b/powershell/plugins/llcsharp-v2.ts @@ -2,7 +2,7 @@ * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { Host, startSession } from '@autorest/extension-base'; +import { AutorestExtensionHost as Host, startSession } from '@autorest/extension-base'; import { codeModelSchema } from '@autorest/codemodel'; import { applyOverrides, copyResources, deserialize, serialize, } from '@azure-tools/codegen'; import { join } from 'path'; @@ -18,17 +18,17 @@ export async function llcsharpV2(service: Host) { return await project.state.resolveVariables(input); }; - await project.writeFiles(async (fname, content) => service.WriteFile(join(project.apifolder, fname), applyOverrides(content, project.overrides), undefined, 'source-file-csharp')); + await project.writeFiles(async (fname, content) => service.writeFile({ filename: join(project.apifolder, fname), content: applyOverrides(content, project.overrides), sourceMap: undefined, artifactType: 'source-file-csharp'})); // recursive copy resources - await copyResources(join(resources, 'runtime', 'csharp', 'client'), async (fname, content) => service.WriteFile(join(project.runtimefolder, fname), content, undefined, 'source-file-csharp'), project.overrides); - await copyResources(join(resources, 'runtime', 'csharp', 'pipeline'), async (fname, content) => service.WriteFile(join(project.runtimefolder, fname), content, undefined, 'source-file-csharp'), project.overrides, transformOutput); + await copyResources(join(resources, 'runtime', 'csharp', 'client'), async (fname, content) => service.writeFile({ filename: join(project.runtimefolder, fname), content: content, sourceMap: undefined, artifactType: 'source-file-csharp'}), project.overrides); + await copyResources(join(resources, 'runtime', 'csharp', 'pipeline'), async (fname, content) => service.writeFile({ filename: join(project.runtimefolder, fname), content: content, sourceMap: undefined, artifactType: 'source-file-csharp'}), project.overrides, transformOutput); // Note: // we are using the Carbon.Json library, but we don't *really* want to expose that as public members where we don't have to // and I don't want to make code changes in the source repository, so I can keep merging from upstream as simple as possible. // so, we're converting as much as possible to internal, and exposing only what must be exposed to make the code compile. - await copyResources(join(resources, 'runtime', 'csharp', 'json'), async (fname, content) => service.WriteFile(join(project.runtimefolder, fname), content, undefined, 'source-file-csharp'), { + await copyResources(join(resources, 'runtime', 'csharp', 'json'), async (fname, content) => service.writeFile({ filename: join(project.runtimefolder, fname), content: content, sourceMap: undefined, artifactType: 'source-file-csharp'}), { ...project.overrides, 'public': 'internal', 'internal (.*) class JsonNumber': 'public $1 class JsonNumber', @@ -65,11 +65,11 @@ export async function llcsharpV2(service: Host) { }); if (project.xmlSerialization) { - await copyResources(join(resources, 'runtime', 'csharp', 'xml'), async (fname, content) => service.WriteFile(join(project.runtimefolder, fname), content, undefined, 'source-file-csharp'), project.overrides); + await copyResources(join(resources, 'runtime', 'csharp', 'xml'), async (fname, content) => service.writeFile({ filename: join(project.runtimefolder, fname), content: content, sourceMap: undefined, artifactType: 'source-file-csharp'}), project.overrides); } if (project.azure) { - await copyResources(join(resources, 'runtime', 'csharp.azure'), async (fname, content) => service.WriteFile(join(project.runtimefolder, fname), content, undefined, 'source-file-csharp'), project.overrides); + await copyResources(join(resources, 'runtime', 'csharp.azure'), async (fname, content) => service.writeFile({ filename: join(project.runtimefolder, fname), content: content, sourceMap: undefined, artifactType: 'source-file-csharp'}), project.overrides); } } catch (E) { diff --git a/powershell/plugins/modifiers-v2.ts b/powershell/plugins/modifiers-v2.ts index fab93fc3586..e4ac0503651 100644 --- a/powershell/plugins/modifiers-v2.ts +++ b/powershell/plugins/modifiers-v2.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { Host, Channel } from '@autorest/extension-base'; +import { AutorestExtensionHost as Host, Channel } from '@autorest/extension-base'; import { pascalCase, serialize, safeEval } from '@azure-tools/codegen'; import { VirtualParameter } from '@autorest/codemodel'; import { items, values, keys, Dictionary, length } from '@azure-tools/linq'; @@ -951,7 +951,7 @@ See https://github.com/Azure/autorest.powershell/blob/main/docs/directives.md#de export async function applyModifiersV2(service: Host) { // dolauli implement directives - const allDirectives = await service.GetValue('directive'); + const allDirectives = await service.getValue('directive'); directives = values(allDirectives) // .select(directive => directive) .where(directive => isWhereCommandDirective(directive) || isWhereModelDirective(directive) || isWhereEnumDirective(directive) || isRemoveCommandDirective(directive)) @@ -960,5 +960,5 @@ export async function applyModifiersV2(service: Host) { const state = await new ModelState(service).init(); const result = await tweakModel(state); - await service.WriteFile('code-model-v4-modifiers-v2.yaml', serialize(result), undefined, 'code-model-v4'); + await service.writeFile({ filename: 'code-model-v4-modifiers-v2.yaml', content: serialize(result), sourceMap: undefined, artifactType: 'code-model-v4'}); } diff --git a/powershell/plugins/plugin-create-inline-properties.ts b/powershell/plugins/plugin-create-inline-properties.ts index e18a6c95825..83c38b2b5aa 100644 --- a/powershell/plugins/plugin-create-inline-properties.ts +++ b/powershell/plugins/plugin-create-inline-properties.ts @@ -6,7 +6,7 @@ import { codeModelSchema, Property, CodeModel, ObjectSchema, ConstantSchema, GroupSchema, isObjectSchema, SchemaType, GroupProperty, ParameterLocation, Operation, Parameter, ImplementationLocation, OperationGroup, Request, SchemaContext } from '@autorest/codemodel'; import { getPascalIdentifier, removeSequentialDuplicates, pascalCase, fixLeadingNumber, deconstruct, selectName, EnglishPluralizationService, serialize } from '@azure-tools/codegen'; import { length, values, } from '@azure-tools/linq'; -import { Host, Session, startSession } from '@autorest/extension-base'; +import { AutorestExtensionHost as Host, Session, startSession } from '@autorest/extension-base'; import { CommandOperation } from '../utils/command-operation'; import { PwshModel } from '../utils/PwshModel'; import { ModelState } from '../utils/model-state'; @@ -454,6 +454,6 @@ export async function createInlinedPropertiesPlugin(service: Host) { //const session = await startSession(service, {}, codeModelSchema); //const result = tweakModelV2(session); const state = await new ModelState(service).init(); - await service.WriteFile('code-model-v4-create-virtual-properties-v2.yaml', serialize(await createVirtuals(state)), undefined, 'code-model-v4'); + await service.writeFile({ filename: 'code-model-v4-create-virtual-properties-v2.yaml', content: serialize(await createVirtuals(state)), sourceMap: undefined, artifactType: 'code-model-v4'}); //return processCodeModel(createVirtuals, service, 'create-virtual-properties-v2'); } diff --git a/powershell/plugins/plugin-tweak-m4-model.ts b/powershell/plugins/plugin-tweak-m4-model.ts index f5e64ef1be0..9a36e7ca470 100644 --- a/powershell/plugins/plugin-tweak-m4-model.ts +++ b/powershell/plugins/plugin-tweak-m4-model.ts @@ -10,7 +10,7 @@ import { StatusCodes } from '../utils/http-definitions'; import { items, values, keys, Dictionary, length } from '@azure-tools/linq'; import { sortPathParameters } from '../utils/sort-parameters'; -import { Host } from '@autorest/extension-base'; +import { AutorestExtensionHost as Host } from '@autorest/extension-base'; type State = ModelState; @@ -192,8 +192,8 @@ function recursiveRemoveM4DefaultDescription(schema: Schema, visited: Set('directive'); directives = values(allDirectives).toArray(); const state = await new ModelState(service).init(); - service.WriteFile('code-model-v4-tweakm4codemodel.yaml', serialize(await tweakModel(state)), undefined, 'code-model-v4'); + service.writeFile({ filename: 'code-model-v4-tweakm4codemodel.yaml', content: serialize(await tweakModel(state)), sourceMap: undefined, artifactType: 'code-model-v4' }); } diff --git a/powershell/plugins/plugin-tweak-model-azure-v2.ts b/powershell/plugins/plugin-tweak-model-azure-v2.ts index 47571260eab..1c639a94942 100644 --- a/powershell/plugins/plugin-tweak-model-azure-v2.ts +++ b/powershell/plugins/plugin-tweak-model-azure-v2.ts @@ -6,7 +6,7 @@ import { keys, length, values } from '@azure-tools/linq'; -import { Channel, Host } from '@autorest/extension-base'; +import { Channel, AutorestExtensionHost as Host } from '@autorest/extension-base'; import { ModelState } from '../utils/model-state'; import { PwshModel } from '../utils/PwshModel'; import { getAllProperties, ObjectSchema, Response, SchemaType, Schema } from '@autorest/codemodel'; @@ -18,7 +18,7 @@ const xmsPageable = 'x-ms-pageable'; async function tweakModel(state: State): Promise { const model = state.model; - // service.Message({ Channel: Channel.Debug, Text: "THIS IS THE AZURE TWEAKER" }); + // service.message{ Channel: Channel.Debug, Text: "THIS IS THE AZURE TWEAKER" }); // TODO: // look at models, and extract out any case that has an IRESOURCE, IPROXYRESOURCE, etc. @@ -198,5 +198,5 @@ function getSchema(response: Response): Schema { export async function tweakModelAzurePluginV2(service: Host) { const state = await new ModelState(service).init(); - await service.WriteFile('code-model-v4-tweakcodemodelazure-v2.yaml', serialize(await tweakModel(state)), undefined, 'code-model-v4'); + await service.writeFile({ filename: 'code-model-v4-tweakcodemodelazure-v2.yaml', content: serialize(await tweakModel(state)), sourceMap: undefined, artifactType: 'code-model-v4'}); } diff --git a/powershell/plugins/plugin-tweak-model.ts b/powershell/plugins/plugin-tweak-model.ts index a011887f98c..4b7303ea946 100644 --- a/powershell/plugins/plugin-tweak-model.ts +++ b/powershell/plugins/plugin-tweak-model.ts @@ -8,7 +8,7 @@ import { items, keys, values, Dictionary, length } from '@azure-tools/linq'; import { PwshModel } from '../utils/PwshModel'; import { ModelState } from '../utils/model-state'; -import { Channel, Host, Session, startSession } from '@autorest/extension-base'; +import { Channel, AutorestExtensionHost as Host, Session, startSession } from '@autorest/extension-base'; import { defaultCipherList } from 'constants'; import { String } from '../llcsharp/schema/string'; import { JsonType } from '../utils/schema'; @@ -178,7 +178,7 @@ async function tweakModelV2(state: State): Promise { if (!(response).schema) { // no response schema? can we fake one? - // service.Message({ Channel: Channel.Debug, Text: `${header.key} is in ${operation.details.default.name} but there is no response model` }); + // service.message{ Channel: Channel.Debug, Text: `${header.key} is in ${operation.details.default.name} but there is no response model` }); continue; } @@ -496,7 +496,7 @@ async function tweakModelV2(state: State): Promise { // if (!response.schema) { // // no response schema? can we fake one? -// // service.Message({ Channel: Channel.Debug, Text: `${header.key} is in ${operation.details.default.name} but there is no response model` }); +// // service.message{ Channel: Channel.Debug, Text: `${header.key} is in ${operation.details.default.name} but there is no response model` }); // continue; // } @@ -645,6 +645,6 @@ export async function tweakModelPlugin(service: Host) { //const session = await startSession(service, {}, codeModelSchema); const state = await new ModelState(service).init(); //const result = tweakModelV2(session); - await service.WriteFile('code-model-v4-tweakcodemodel-v2.yaml', serialize(await tweakModelV2(state)), undefined, 'code-model-v4'); + await service.writeFile({ filename: 'code-model-v4-tweakcodemodel-v2.yaml', content: serialize(await tweakModelV2(state)), sourceMap: undefined, artifactType: 'code-model-v4'}); //return processCodeModel(tweakModelV2, service, 'tweakcodemodel-v2'); } diff --git a/powershell/plugins/powershell-v2.ts b/powershell/plugins/powershell-v2.ts index 60dc210e4da..2279e50ab6d 100644 --- a/powershell/plugins/powershell-v2.ts +++ b/powershell/plugins/powershell-v2.ts @@ -11,7 +11,7 @@ import { copyBinaryResources, safeEval, } from '@azure-tools/codegen'; -import { Host } from '@autorest/extension-base'; +import { AutorestExtensionHost as Host } from '@autorest/extension-base'; import { join } from 'path'; import { Project } from '../internal/project'; import { generatePsm1 } from '../generators/psm1'; @@ -100,7 +100,7 @@ async function copyRequiredFiles(project: Project) { } export async function powershellV2(service: Host) { - const debug = (await service.GetValue('debug')) || false; + const debug = (await service.getValue('debug')) || false; try { const project = await new Project(service).init(); @@ -114,14 +114,14 @@ export async function powershellV2(service: Host) { ) ); - await service.ProtectFiles(project.psd1); - await service.ProtectFiles(project.readme); - await service.ProtectFiles(project.customFolder); - await service.ProtectFiles(project.testFolder); - await service.ProtectFiles(project.docsFolder); - await service.ProtectFiles(project.examplesFolder); - await service.ProtectFiles(project.resourcesFolder); - await service.ProtectFiles(project.uxFolder); + await service.protectFiles(project.psd1); + await service.protectFiles(project.readme); + await service.protectFiles(project.customFolder); + await service.protectFiles(project.testFolder); + await service.protectFiles(project.docsFolder); + await service.protectFiles(project.examplesFolder); + await service.protectFiles(project.resourcesFolder); + await service.protectFiles(project.uxFolder); // wait for all the generation to be done await copyRequiredFiles(project); diff --git a/powershell/plugins/ps-namer-v2.ts b/powershell/plugins/ps-namer-v2.ts index 9181733c5a6..89bba4211e2 100644 --- a/powershell/plugins/ps-namer-v2.ts +++ b/powershell/plugins/ps-namer-v2.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import { codeModelSchema, CodeModel, Schema, ObjectSchema, GroupSchema, isObjectSchema, SchemaType, GroupProperty, ParameterLocation, Operation, Parameter, getAllProperties, ImplementationLocation, OperationGroup, Request, SchemaContext } from '@autorest/codemodel'; -import { Host, Channel, Session, startSession } from '@autorest/extension-base'; +import { AutorestExtensionHost as Host, Channel, Session, startSession } from '@autorest/extension-base'; //import { allVirtualParameters, allVirtualProperties, resolveParameterNames, resolvePropertyNames } from '@azure-tools/codemodel-v3'; import { deconstruct, removeProhibitedPrefix, removeSequentialDuplicates, pascalCase, serialize } from '@azure-tools/codegen'; import { items, values, keys, Dictionary, length } from '@azure-tools/linq'; @@ -209,5 +209,5 @@ export async function namerV2(service: Host) { //const session = await startSession(service, {}, codeModelSchema); //const result = tweakModelV2(session); const state = await new ModelState(service).init(); - await service.WriteFile('code-model-v4-psnamer-v2.yaml', serialize(await tweakModel(state)), undefined, 'code-model-v4'); + await service.writeFile({ filename: 'code-model-v4-psnamer-v2.yaml', content: serialize(await tweakModel(state)), sourceMap: undefined, artifactType: 'code-model-v4'}); } \ No newline at end of file diff --git a/powershell/plugins/sdk-create-inline-properties.ts b/powershell/plugins/sdk-create-inline-properties.ts index ee1f10abcc5..6dd27d6056f 100644 --- a/powershell/plugins/sdk-create-inline-properties.ts +++ b/powershell/plugins/sdk-create-inline-properties.ts @@ -6,7 +6,7 @@ import { codeModelSchema, Property, CodeModel, ObjectSchema, ConstantSchema, GroupSchema, isObjectSchema, SchemaType, GroupProperty, ParameterLocation, Operation, Parameter, ImplementationLocation, OperationGroup, Request, SchemaContext, Protocol, Schemas, Schema } from '@autorest/codemodel'; import { getPascalIdentifier, removeSequentialDuplicates, pascalCase, fixLeadingNumber, deconstruct, selectName, EnglishPluralizationService, serialize, camelCase } from '@azure-tools/codegen'; import { length, values, } from '@azure-tools/linq'; -import { Host, Session, startSession } from '@autorest/extension-base'; +import { AutorestExtensionHost as Host, Session, startSession } from '@autorest/extension-base'; import { CommandOperation } from '../utils/command-operation'; import { PwshModel } from '../utils/PwshModel'; import { ModelState } from '../utils/model-state'; @@ -602,6 +602,6 @@ export async function createSdkInlinedPropertiesPlugin(service: Host) { //const session = await startSession(service, {}, codeModelSchema); //const result = tweakModelV2(session); const state = await new ModelState(service).init(); - await service.WriteFile('sdk-code-model-v4-create-virtual-properties-v2.yaml', serialize(await createVirtuals(state)), undefined, 'code-model-v4'); + await service.writeFile({ filename: 'sdk-code-model-v4-create-virtual-properties-v2.yaml', content: serialize(await createVirtuals(state)), sourceMap: undefined, artifactType: 'code-model-v4'}); //return processCodeModel(createVirtuals, service, 'create-virtual-properties-v2'); } \ No newline at end of file diff --git a/powershell/plugins/sdk-cs-namer.ts b/powershell/plugins/sdk-cs-namer.ts index 4e1d0349868..2c394ca203c 100644 --- a/powershell/plugins/sdk-cs-namer.ts +++ b/powershell/plugins/sdk-cs-namer.ts @@ -8,7 +8,7 @@ import { camelCase, deconstruct, excludeXDash, fixLeadingNumber, pascalCase, low import { items, values, keys, Dictionary, length } from '@azure-tools/linq'; import { System } from '@azure-tools/codegen-csharp'; -import { Channel, Host, Session, startSession } from '@autorest/extension-base'; +import { Channel, AutorestExtensionHost as Host, Session, startSession } from '@autorest/extension-base'; import { SchemaDetails } from '../llcsharp/code-model'; import { SchemaDefinitionResolver } from '../llcsharp/schema/schema-resolver'; import { SdkModel } from '../utils/SdkModel'; @@ -422,5 +422,5 @@ async function nameStuffRight(state: State): Promise { export async function csnamerSdk(service: Host) { const state = await new ModelState(service).init(); - await service.WriteFile('sdk-code-model-v4-csnamer.yaml', serialize(await nameStuffRight(state)), undefined, 'code-model-v4'); + await service.writeFile({ filename: 'sdk-code-model-v4-csnamer.yaml', content: serialize(await nameStuffRight(state)), sourceMap: undefined, artifactType: 'code-model-v4'}); } diff --git a/powershell/plugins/sdk-cs-simplifier.ts b/powershell/plugins/sdk-cs-simplifier.ts index 76d0c836dd1..fcd053343a1 100644 --- a/powershell/plugins/sdk-cs-simplifier.ts +++ b/powershell/plugins/sdk-cs-simplifier.ts @@ -5,7 +5,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { Host } from '@autorest/extension-base'; +import { AutorestExtensionHost as Host } from '@autorest/extension-base'; import { TrieNode } from '../utils/TrieNode'; const predifinedNamespaces: Set = new Set(['Newtonsoft.Json', 'Newtonsoft.Json.Converters', 'System.Collections', 'System.Collections.Generic', 'System.Net', 'System.Net.Http', 'System.Threading', 'System.Threading.Tasks', 'Microsoft.Rest.Serialization', 'System.IO', 'System.Runtime', 'System.Runtime.Serialization', 'Microsoft.Rest', 'Microsoft.Rest.Azure', 'System.Linq', 'Models']); @@ -27,16 +27,16 @@ const thisRegex = /this\./g; const characterCheckRegex = /(?![a-zA-Z])/i; export async function simplifierPlugin(service: Host) { - const files = await service.ListInputs(); + const files = await service.listInputs(); const trimTasks = files.map(async file => { let namespacesToAdd: Set = new Set(); - let content: string = await service.ReadFile(file); + let content: string = await service.readFile(file); const usings = findUsing(content, namespacesToAdd); const beforeUsings: string = content.substring(0, usings[0]); let afterUsings: string = content.substring(usings[1]); afterUsings = trimNamespace(afterUsings, namespacesToAdd); content = removeThis(addUsings(beforeUsings, afterUsings, sortNamespaces([...namespacesToAdd]).join(''))); - service.WriteFile(file, content, undefined, 'source-file-csharp'); + service.writeFile({ filename: file, content: content, sourceMap: undefined, artifactType: 'source-file-csharp'}); }); await Promise.all(trimTasks); } diff --git a/powershell/plugins/sdk-generate.ts b/powershell/plugins/sdk-generate.ts index f8fe9e1c7da..496507224d5 100644 --- a/powershell/plugins/sdk-generate.ts +++ b/powershell/plugins/sdk-generate.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import { values } from '@azure-tools/linq'; -import { Host } from '@autorest/extension-base'; +import { AutorestExtensionHost as Host } from '@autorest/extension-base'; import { join } from 'path'; import { CodeModel, ObjectSchema } from '@autorest/codemodel'; import { ModelState } from '../utils/model-state'; diff --git a/powershell/plugins/sdk-tweak-model.ts b/powershell/plugins/sdk-tweak-model.ts index 1195d79aca4..afb0dd18b4e 100644 --- a/powershell/plugins/sdk-tweak-model.ts +++ b/powershell/plugins/sdk-tweak-model.ts @@ -10,7 +10,7 @@ import { ModelState } from '../utils/model-state'; import { StatusCodes } from '../utils/http-definitions'; import { items, values, keys, Dictionary, length, isValue } from '@azure-tools/linq'; import { SchemaDetails } from '../llcsharp/code-model'; -import { Host } from '@autorest/extension-base'; +import { AutorestExtensionHost as Host } from '@autorest/extension-base'; import { codemodel, schema } from '@azure-tools/codemodel-v3'; import { VirtualProperty, getAllPublicVirtualPropertiesForSdk, valueType } from '../utils/schema'; import { SchemaDefinitionResolver } from '../llcsharp/exports'; @@ -370,9 +370,9 @@ function addAzureProperties(globalParameters: Array) { export async function tweakSdkModelPlugin(service: Host) { const state = await new ModelState(service).init(); - const debug = await service.GetValue('debug') || false; + const debug = await service.getValue('debug') || false; try { - service.WriteFile('sdk-code-model-v4-tweaksdk.yaml', serialize(await tweakModel(state)), undefined, 'code-model-v4'); + service.writeFile({ filename: 'sdk-code-model-v4-tweaksdk.yaml', content: serialize(await tweakModel(state)), sourceMap: undefined, artifactType: 'code-model-v4'}); } catch (E) { if (debug && E instanceof Error) { console.error(`${__filename} - FAILURE ${JSON.stringify(E)} ${E.stack} `); diff --git a/powershell/sdk/project.ts b/powershell/sdk/project.ts index 1409557736a..4eead75314d 100644 --- a/powershell/sdk/project.ts +++ b/powershell/sdk/project.ts @@ -11,7 +11,7 @@ import { EnumNamespace } from '../enums/namespace'; import { ModelExtensionsNamespace } from '../models/model-extensions'; import { ModuleNamespace } from '../module/module-namespace'; -import { Host } from '@autorest/extension-base'; +import { AutorestExtensionHost as Host } from '@autorest/extension-base'; import { PropertyDetails, exportedModels as T } from '@azure-tools/codemodel-v3'; import { DeepPartial, comment } from '@azure-tools/codegen'; import { CodeModel } from '@autorest/codemodel'; diff --git a/powershell/sdk/state.ts b/powershell/sdk/state.ts index 3f4489e5816..841874bde0a 100644 --- a/powershell/sdk/state.ts +++ b/powershell/sdk/state.ts @@ -5,7 +5,7 @@ import { CodeModel } from '@autorest/codemodel'; -import { Host, JsonPath, Session } from '@autorest/extension-base'; +import { AutorestExtensionHost as Host, JsonPointerSegments as JsonPath, Session } from '@autorest/extension-base'; import { Project } from './project'; import { DeepPartial } from '@azure-tools/codegen'; import { PwshModel } from '../utils/PwshModel'; diff --git a/powershell/test/operationId-inferring.ts b/powershell/test/operationId-inferring.ts index ad4a3d3a574..1c665ae5102 100644 --- a/powershell/test/operationId-inferring.ts +++ b/powershell/test/operationId-inferring.ts @@ -7,7 +7,7 @@ import * as assert from 'assert'; import { suite, test } from '@testdeck/mocha'; import * as pp from '../plugins/create-commands-v2'; -import { Channel, JsonPath, Mapping, RawSourceMap, Message } from '@autorest/extension-base'; +import { Channel, JsonPointerSegments as JsonPath, Mapping, RawSourceMap, Message } from '@autorest/extension-base'; import { items, values, keys, Dictionary, length } from '@azure-tools/linq'; require('source-map-support').install(); diff --git a/powershell/utils/model-state.ts b/powershell/utils/model-state.ts index 9420cb08875..654196fc665 100644 --- a/powershell/utils/model-state.ts +++ b/powershell/utils/model-state.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { Channel, Host, JsonPath, Mapping, RawSourceMap, Message } from '@autorest/extension-base'; +import { Channel, AutorestExtensionHost as Host, JsonPointerSegments as JsonPath, Mapping, RawSourceMap, Message } from '@autorest/extension-base'; import { safeEval, deserialize, Initializer, DeepPartial } from '@azure-tools/codegen'; import { Dictionary } from '@azure-tools/linq'; @@ -32,7 +32,7 @@ export class ModelState> extends Initializer { async initContext(project: any) { this.context = this.context || { - $config: await this.service.GetValue(''), + $config: await this.service.getValue(''), $project: project, $lib: { path: require('path') @@ -42,7 +42,7 @@ export class ModelState> extends Initializer { } async readFile(filename: string): Promise { - return this.service.ReadFile(filename); + return this.service.readFile(filename); } @@ -52,7 +52,7 @@ export class ModelState> extends Initializer { // fall back to the configuration if (value == null || value === undefined) { - value = await this.service.GetValue(key); + value = await this.service.getValue(key); } // try as a safe eval execution. @@ -82,14 +82,14 @@ export class ModelState> extends Initializer { } async listInputs(artifactType?: string | undefined): Promise> { - return this.service.ListInputs(artifactType); + return this.service.listInputs(artifactType); } async protectFiles(path: string): Promise { - return this.service.ProtectFiles(path); + return this.service.protectFiles(path); } writeFile(filename: string, content: string, sourceMap?: Array | RawSourceMap | undefined, artifactType?: string | undefined): void { - return this.service.WriteFile(filename, content, sourceMap, artifactType); + return this.service.writeFile({ filename: filename, content: content, sourceMap: sourceMap, artifactType: artifactType}); } message(message: Message): void { @@ -99,7 +99,7 @@ export class ModelState> extends Initializer { if (message.Channel === Channel.Verbose && this._verbose === false) { return; } - return this.service.Message(message); + return this.service.message(message); } updateConfigurationFile(filename: string, content: string): void { @@ -111,14 +111,14 @@ export class ModelState> extends Initializer { protected errorCount = 0; protected static async getModel(service: Host) { - const files = await service.ListInputs(); + const files = await service.listInputs(); const filename = files[0]; if (files.length === 0) { throw new Error('Inputs missing.'); } return { filename, - model: deserialize(await service.ReadFile(filename), filename) + model: deserialize(await service.readFile(filename), filename) }; }