From 1bcf946e27ae481f52fbf1174d79e50ba272a498 Mon Sep 17 00:00:00 2001 From: ZiWei Chen <98569699+kazrael2119@users.noreply.github.com> Date: Tue, 29 Oct 2024 16:14:54 +0800 Subject: [PATCH] remove core-http dependency (#2874) * remove core-http dependency * update --------- Co-authored-by: Qiaoqiao Zhang <55688292+qiaozha@users.noreply.github.com> --- common/config/rush/pnpm-lock.yaml | 8 +++----- .../src/generators/static/packageFileGenerator.ts | 3 --- .../src/transforms/mapperTransforms.ts | 14 +++++++------- .../generated/corecompattest/package.json | 1 - .../integration/generated/datasearch/package.json | 1 - .../integration/generated/patterntest/package.json | 1 - .../generated/useragentcorev1/package.json | 2 +- 7 files changed, 11 insertions(+), 19 deletions(-) diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index a46b4c1e61..770a9d1f84 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -670,14 +670,13 @@ packages: tslib: 2.6.2 transitivePeerDependencies: - supports-color - dev: true /@azure/core-http-compat/1.3.0: resolution: {integrity: sha512-ZN9avruqbQ5TxopzG3ih3KRy52n8OAbitX3fnZT5go4hzu0J+KVPSzkL+Wt3hpJpdG8WIfg1sBD1tWkgUdEpBA==} engines: {node: '>=12.0.0'} dependencies: '@azure/abort-controller': 1.1.0 - '@azure/core-client': 1.7.3 + '@azure/core-client': 1.9.2 '@azure/core-rest-pipeline': 1.14.0 transitivePeerDependencies: - supports-color @@ -697,11 +696,12 @@ packages: /@azure/core-http/3.0.3: resolution: {integrity: sha512-QMib3wXotJMFhHgmJBPUF9YsyErw34H0XDFQd9CauH7TPB+RGcyl9Ayy7iURtJB04ngXhE6YwrQsWDXlSLrilg==} engines: {node: '>=14.0.0'} + deprecated: This package is no longer supported. Please migrate to use @azure/core-rest-pipeline dependencies: '@azure/abort-controller': 1.1.0 '@azure/core-auth': 1.6.0 '@azure/core-tracing': 1.0.0-preview.13 - '@azure/core-util': 1.5.0 + '@azure/core-util': 1.9.0 '@azure/logger': 1.0.4 '@types/node-fetch': 2.6.6 '@types/tunnel': 0.0.3 @@ -773,7 +773,6 @@ packages: engines: {node: '>=18.0.0'} dependencies: tslib: 2.6.2 - dev: true /@azure/core-util/1.5.0: resolution: {integrity: sha512-GZBpVFDtQ/15hW1OgBcRdT4Bl7AEpcEZqLfbAvOtm1CQUncKWiYapFHVD588hmlV27NbOOtSm3cnLF3lvoHi4g==} @@ -788,7 +787,6 @@ packages: dependencies: '@azure/abort-controller': 2.1.2 tslib: 2.6.2 - dev: true /@azure/core-xml/1.3.4: resolution: {integrity: sha512-B1xI79Ur/u+KR69fGTcsMNj8KDjBSqAy0Ys6Byy4Qm1CqoUy7gCT5A7Pej0EBWRskuH6bpCwrAnosfmQEalkcg==} diff --git a/packages/autorest.typescript/src/generators/static/packageFileGenerator.ts b/packages/autorest.typescript/src/generators/static/packageFileGenerator.ts index 057fe841dd..8c75dc509a 100644 --- a/packages/autorest.typescript/src/generators/static/packageFileGenerator.ts +++ b/packages/autorest.typescript/src/generators/static/packageFileGenerator.ts @@ -89,11 +89,8 @@ function regularAutorestPackage( ...(hasLro && { "@azure/core-lro": "^2.5.4" }), ...(hasLro && { "@azure/abort-controller": "^2.1.2" }), ...(hasAsyncIterators && { "@azure/core-paging": "^1.2.0" }), - ...(!useCoreV2 && { "@azure/core-http": "^3.0.0" }), ...(useCoreV2 && { "@azure/core-client": "^1.7.0" }), ...(useCoreV2 && addCredentials && { "@azure/core-auth": "^1.6.0" }), - ...(useCoreV2 && - coreHttpCompatMode && { "@azure/core-http-compat": "^1.2.0" }), ...(useCoreV2 && { "@azure/core-rest-pipeline": "^1.14.0" }), diff --git a/packages/autorest.typescript/src/transforms/mapperTransforms.ts b/packages/autorest.typescript/src/transforms/mapperTransforms.ts index b7f3c1206a..302a58ed6d 100644 --- a/packages/autorest.typescript/src/transforms/mapperTransforms.ts +++ b/packages/autorest.typescript/src/transforms/mapperTransforms.ts @@ -60,8 +60,8 @@ const primitiveSchemaTypes = [ */ const pipe = (...fns: Array<(pipelineValue: PipelineValue) => PipelineValue>) => - (x: PipelineValue) => - fns.reduce((v, f) => (!v.isHandled ? f(v) : v), x); + (x: PipelineValue) => + fns.reduce((v, f) => (!v.isHandled ? f(v) : v), x); export type ModelProperties = { [propertyName: string]: Mapper | string[] }; @@ -306,10 +306,10 @@ function buildAdditionalProperties( const additionalProperties = getAdditionalProperties(objectSchema); return additionalProperties ? { - type: { - name: MapperType.Object - } + type: { + name: MapperType.Object } + } : undefined; } @@ -360,8 +360,8 @@ function transformObjectMapper(pipelineValue: PipelineValue) { (p as ObjectSchema).discriminator && uberParents.includes(getMapperClassName(p)) ) || - parents.find((p) => uberParents.includes(getMapperClassName(p))) || - schema + parents.find((p) => uberParents.includes(getMapperClassName(p))) || + schema ); if (objectSchema.parents?.immediate[0]) { diff --git a/packages/autorest.typescript/test/integration/generated/corecompattest/package.json b/packages/autorest.typescript/test/integration/generated/corecompattest/package.json index 406f89d662..6529786940 100644 --- a/packages/autorest.typescript/test/integration/generated/corecompattest/package.json +++ b/packages/autorest.typescript/test/integration/generated/corecompattest/package.json @@ -8,7 +8,6 @@ "dependencies": { "@azure/core-client": "^1.7.0", "@azure/core-auth": "^1.6.0", - "@azure/core-http-compat": "^1.2.0", "@azure/core-rest-pipeline": "^1.14.0", "tslib": "^2.2.0" }, diff --git a/packages/autorest.typescript/test/integration/generated/datasearch/package.json b/packages/autorest.typescript/test/integration/generated/datasearch/package.json index 88b7427323..079ab2270a 100644 --- a/packages/autorest.typescript/test/integration/generated/datasearch/package.json +++ b/packages/autorest.typescript/test/integration/generated/datasearch/package.json @@ -7,7 +7,6 @@ "engines": { "node": ">=18.0.0" }, "dependencies": { "@azure/core-client": "^1.7.0", - "@azure/core-http-compat": "^1.2.0", "@azure/core-rest-pipeline": "^1.14.0", "tslib": "^2.2.0" }, diff --git a/packages/autorest.typescript/test/integration/generated/patterntest/package.json b/packages/autorest.typescript/test/integration/generated/patterntest/package.json index 3ff4afdf92..808464700e 100644 --- a/packages/autorest.typescript/test/integration/generated/patterntest/package.json +++ b/packages/autorest.typescript/test/integration/generated/patterntest/package.json @@ -7,7 +7,6 @@ "engines": { "node": ">=18.0.0" }, "dependencies": { "@azure/core-client": "^1.7.0", - "@azure/core-http-compat": "^1.2.0", "@azure/core-rest-pipeline": "^1.14.0", "tslib": "^2.2.0" }, diff --git a/packages/autorest.typescript/test/integration/generated/useragentcorev1/package.json b/packages/autorest.typescript/test/integration/generated/useragentcorev1/package.json index 225ff6386a..09fa43b63c 100644 --- a/packages/autorest.typescript/test/integration/generated/useragentcorev1/package.json +++ b/packages/autorest.typescript/test/integration/generated/useragentcorev1/package.json @@ -5,7 +5,7 @@ "description": "A generated SDK for UserAgentCoreV1Client.", "version": "1.0.0-preview1", "engines": { "node": ">=18.0.0" }, - "dependencies": { "@azure/core-http": "^3.0.0", "tslib": "^2.2.0" }, + "dependencies": { "tslib": "^2.2.0" }, "keywords": ["node", "azure", "typescript", "browser", "isomorphic"], "license": "MIT", "main": "./dist/index.js",