diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index 479fa0a556..78fe5f64a7 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -261,7 +261,7 @@ importers: '@typespec/http': '>=0.63.0 <1.0.0' '@typespec/openapi': '>=0.63.0, <1.0.0' '@typespec/rest': '>=0.63.0 <1.0.0' - '@typespec/ts-http-runtime': 1.0.0-alpha.20240314.2 + '@typespec/ts-http-runtime': 0.1.0 '@typespec/versioning': '>=0.63.0 <1.0.0' '@vitest/coverage-istanbul': ~1.6.0 '@vitest/coverage-v8': ~1.6.0 @@ -319,7 +319,7 @@ importers: '@typespec/http': 0.63.0_@typespec+compiler@0.63.0 '@typespec/openapi': 0.63.0_qz2z3dajrrgsjonwob7haqlhte '@typespec/rest': 0.63.0_qz2z3dajrrgsjonwob7haqlhte - '@typespec/ts-http-runtime': 1.0.0-alpha.20240314.2 + '@typespec/ts-http-runtime': 0.1.0 '@typespec/versioning': 0.63.0_@typespec+compiler@0.63.0 '@vitest/coverage-istanbul': 1.6.0_vitest@1.6.0 '@vitest/coverage-v8': 1.6.0_vitest@1.6.0 @@ -2430,7 +2430,7 @@ packages: change-case: 5.4.4 globby: 14.0.2 mustache: 4.2.0 - picocolors: 1.1.1 + picocolors: 1.1.0 prettier: 3.3.3 prompts: 2.4.2 semver: 7.6.3 @@ -2550,12 +2550,12 @@ packages: '@typespec/compiler': 0.63.0 '@typespec/http': 0.63.0_@typespec+compiler@0.63.0 - /@typespec/ts-http-runtime/1.0.0-alpha.20240314.2: - resolution: {integrity: sha512-Rc/bFkKLbrEo9KKXiSdRYNSmosZ1W6ycQKEKScpXvK4jaXFNyCvmS0tLv7rEN4EzEEds2fPzEHNtX4e8gMu/lA==} + /@typespec/ts-http-runtime/0.1.0: + resolution: {integrity: sha512-0NspintCRrSIIZBUtVfWjJ5TpOjpP0mNsJXZOqzuxdY/q2yCr0amyUCEw+WLhRykP39XMNMG0f1F9LbC2+c+Rw==} engines: {node: '>=18.0.0'} dependencies: - http-proxy-agent: 7.0.0 - https-proxy-agent: 7.0.2 + http-proxy-agent: 7.0.2 + https-proxy-agent: 7.0.4 tslib: 2.6.2 transitivePeerDependencies: - supports-color @@ -5145,16 +5145,6 @@ packages: transitivePeerDependencies: - supports-color - /http-proxy-agent/7.0.0: - resolution: {integrity: sha512-+ZT+iBxVUQ1asugqnD6oWoRiS25AkjNfG085dKJGtGxkdwLQrMKU5wJr2bOOFAXzKcTuqq+7fZlTMgG3SRfIYQ==} - engines: {node: '>= 14'} - dependencies: - agent-base: 7.1.0 - debug: 4.3.4 - transitivePeerDependencies: - - supports-color - dev: true - /http-proxy-agent/7.0.2: resolution: {integrity: sha512-T1gkAiYYDWYx3V5Bmyu7HcfcvL7mUrTWiM6yOfa3PIphViJ/gFPbvidQ+veqSOHci/PxBcDabeUNCzpOODJZig==} engines: {node: '>= 14'} @@ -5194,16 +5184,6 @@ packages: transitivePeerDependencies: - supports-color - /https-proxy-agent/7.0.2: - resolution: {integrity: sha512-NmLNjm6ucYwtcUmL7JQC1ZQ57LmHP4lT15FQ8D61nak1rO6DH+fz5qNK2Ap5UN4ZapYICE3/0KodcLYSPsPbaA==} - engines: {node: '>= 14'} - dependencies: - agent-base: 7.1.0 - debug: 4.3.4 - transitivePeerDependencies: - - supports-color - dev: true - /https-proxy-agent/7.0.4: resolution: {integrity: sha512-wlwpilI7YdjSkWaQ/7omYBMTliDcmCN8OLihO6I9B86g06lMyAoqgoDpV0XqoaPOKj+0DIdAvnsWfyAAhmimcg==} engines: {node: '>= 14'} diff --git a/packages/rlc-common/src/buildClient.ts b/packages/rlc-common/src/buildClient.ts index 615d27248d..9d45a74b59 100644 --- a/packages/rlc-common/src/buildClient.ts +++ b/packages/rlc-common/src/buildClient.ts @@ -339,10 +339,17 @@ export function getClientFactoryBody( `\${${urlParameter.name}}` ); }); - - endpointUrl = `options.endpoint ?? options.baseUrl ?? \`${parsedEndpoint}\``; + if (model.options.flavor !== "azure") { + endpointUrl = `options.endpoint ?? \`${parsedEndpoint}\``; + } else { + endpointUrl = `options.endpoint ?? options.baseUrl ?? \`${parsedEndpoint}\``; + } } else { - endpointUrl = `options.endpoint ?? options.baseUrl ?? "${endpoint}"`; + if (model.options.flavor !== "azure") { + endpointUrl = `options.endpoint ??"${endpoint}"`; + } else { + endpointUrl = `options.endpoint ?? options.baseUrl ?? "${endpoint}"`; + } } if (!model.options.isModularLibrary && !clientPackageName.endsWith("-rest")) { diff --git a/packages/rlc-common/src/helpers/importsUtil.ts b/packages/rlc-common/src/helpers/importsUtil.ts index 86284b3a4e..6bd50e5b8e 100644 --- a/packages/rlc-common/src/helpers/importsUtil.ts +++ b/packages/rlc-common/src/helpers/importsUtil.ts @@ -55,7 +55,7 @@ export function buildRuntimeImports(flavor?: PackageFlavor): Imports { commonFallback: { type: "commonFallback", specifier: "@typespec/ts-http-runtime", - version: "1.0.0-alpha.20240314.2" + version: "0.1.0" } } as Imports; } diff --git a/packages/rlc-common/src/metadata/packageJson/buildFlavorlessPackage.ts b/packages/rlc-common/src/metadata/packageJson/buildFlavorlessPackage.ts index 161e62c065..c29708b09a 100644 --- a/packages/rlc-common/src/metadata/packageJson/buildFlavorlessPackage.ts +++ b/packages/rlc-common/src/metadata/packageJson/buildFlavorlessPackage.ts @@ -24,7 +24,7 @@ export function buildFlavorlessPackage(config: PackageCommonInfoConfig) { }, dependencies: { ...commonPackageDependencies, - "@typespec/ts-http-runtime": "1.0.0-alpha.20240314.2" + "@typespec/ts-http-runtime": "0.1.0" } }; diff --git a/packages/rlc-common/test/helpers/importsUtil.spec.ts b/packages/rlc-common/test/helpers/importsUtil.spec.ts index 878af744d2..da15f5841e 100644 --- a/packages/rlc-common/test/helpers/importsUtil.spec.ts +++ b/packages/rlc-common/test/helpers/importsUtil.spec.ts @@ -21,7 +21,7 @@ describe("#buildRuntimeImports", () => { expect(imports.commonFallback).to.deep.equal({ type: "commonFallback", specifier: "@typespec/ts-http-runtime", - version: "1.0.0-alpha.20240314.2" + version: "0.1.0" }); expect(imports.restClient).to.be.undefined; }); diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/package.json b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/package.json index 6c3aa56336..add2293a1b 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/package.json +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/package.json @@ -56,7 +56,7 @@ }, "dependencies": { "tslib": "^2.6.2", - "@typespec/ts-http-runtime": "1.0.0-alpha.20240314.2" + "@typespec/ts-http-runtime": "0.1.0" }, "exports": { "./package.json": "./package.json", diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/openAIContext.ts b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/openAIContext.ts index 7bd77ff53a..542614a006 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/openAIContext.ts +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/openAIContext.ts @@ -19,8 +19,7 @@ export function createOpenAI( credential: KeyCredential, options: OpenAIClientOptionalParams = {}, ): OpenAIContext { - const endpointUrl = - options.endpoint ?? options.baseUrl ?? `https://api.openai.com/v1`; + const endpointUrl = options.endpoint ?? `https://api.openai.com/v1`; const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix; const userAgentInfo = `azsdk-js-openai-non-branded/1.0.0-beta.1`; const userAgentPrefix = prefixFromOptions diff --git a/packages/typespec-test/test/todo_non_branded/generated/typespec-ts/package.json b/packages/typespec-test/test/todo_non_branded/generated/typespec-ts/package.json index 5de973201a..9f4b34033d 100644 --- a/packages/typespec-test/test/todo_non_branded/generated/typespec-ts/package.json +++ b/packages/typespec-test/test/todo_non_branded/generated/typespec-ts/package.json @@ -47,7 +47,7 @@ }, "dependencies": { "tslib": "^2.6.2", - "@typespec/ts-http-runtime": "1.0.0-alpha.20240314.2" + "@typespec/ts-http-runtime": "0.1.0" }, "exports": { "./package.json": "./package.json", diff --git a/packages/typespec-ts/package.json b/packages/typespec-ts/package.json index b7ec44d1ad..f1828c9d21 100644 --- a/packages/typespec-ts/package.json +++ b/packages/typespec-ts/package.json @@ -89,7 +89,7 @@ "@typespec/http": ">=0.63.0 <1.0.0", "@typespec/openapi": ">=0.63.0, <1.0.0", "@typespec/rest": ">=0.63.0 <1.0.0", - "@typespec/ts-http-runtime": "1.0.0-alpha.20240314.2", + "@typespec/ts-http-runtime": "0.1.0", "@typespec/versioning": ">=0.63.0 <1.0.0", "chai": "^4.3.6", "chalk": "^4.0.0", diff --git a/packages/typespec-ts/src/modular/helpers/clientHelpers.ts b/packages/typespec-ts/src/modular/helpers/clientHelpers.ts index 1dbfac8757..486a061c37 100644 --- a/packages/typespec-ts/src/modular/helpers/clientHelpers.ts +++ b/packages/typespec-ts/src/modular/helpers/clientHelpers.ts @@ -194,7 +194,13 @@ export function buildGetClientEndpointParam( `\${${getClientParameterName(param)}}` ); } - const endpointUrl = `const endpointUrl = options.endpoint ?? options.baseUrl ?? \`${parameterizedEndpointUrl}\``; + let endpointUrl = ""; + if (dpgContext.rlcOptions?.flavor === "azure") { + endpointUrl = `const endpointUrl = options.endpoint ?? options.baseUrl ?? \`${parameterizedEndpointUrl}\``; + } else { + // unbranded does not have the deprecated baseUrl parameter + endpointUrl = `const endpointUrl = options.endpoint ?? \`${parameterizedEndpointUrl}\``; + } context.addStatements(endpointUrl); return "endpointUrl"; }