@azure-tools/typespec-ts 0.55.0-dev.4 → 0.55.0-dev.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (120) hide show
  1. package/README.md +1 -13
  2. package/dist/src/framework/load-static-helpers.d.ts.map +1 -1
  3. package/dist/src/framework/load-static-helpers.js +1 -11
  4. package/dist/src/framework/load-static-helpers.js.map +1 -1
  5. package/dist/src/index.d.ts.map +1 -1
  6. package/dist/src/index.js +18 -38
  7. package/dist/src/index.js.map +1 -1
  8. package/dist/src/lib.d.ts +1 -3
  9. package/dist/src/lib.d.ts.map +1 -1
  10. package/dist/src/lib.js +1 -11
  11. package/dist/src/lib.js.map +1 -1
  12. package/dist/src/modular/build-client-context.d.ts.map +1 -1
  13. package/dist/src/modular/build-client-context.js +6 -15
  14. package/dist/src/modular/build-client-context.js.map +1 -1
  15. package/dist/src/modular/build-root-index.d.ts.map +1 -1
  16. package/dist/src/modular/build-root-index.js +4 -7
  17. package/dist/src/modular/build-root-index.js.map +1 -1
  18. package/dist/src/modular/emit-logger-file.d.ts.map +1 -1
  19. package/dist/src/modular/emit-logger-file.js +0 -3
  20. package/dist/src/modular/emit-logger-file.js.map +1 -1
  21. package/dist/src/modular/emit-samples.js +7 -24
  22. package/dist/src/modular/emit-samples.js.map +1 -1
  23. package/dist/src/modular/helpers/client-helpers.d.ts.map +1 -1
  24. package/dist/src/modular/helpers/client-helpers.js +6 -16
  25. package/dist/src/modular/helpers/client-helpers.js.map +1 -1
  26. package/dist/src/modular/helpers/example-value-helpers.d.ts +1 -1
  27. package/dist/src/modular/helpers/example-value-helpers.d.ts.map +1 -1
  28. package/dist/src/modular/helpers/example-value-helpers.js +7 -24
  29. package/dist/src/modular/helpers/example-value-helpers.js.map +1 -1
  30. package/dist/src/modular/helpers/operation-helpers.js +1 -1
  31. package/dist/src/modular/helpers/operation-helpers.js.map +1 -1
  32. package/dist/src/rlc-common/build-client.d.ts.map +1 -1
  33. package/dist/src/rlc-common/build-client.js +13 -20
  34. package/dist/src/rlc-common/build-client.js.map +1 -1
  35. package/dist/src/rlc-common/build-index-file.d.ts.map +1 -1
  36. package/dist/src/rlc-common/build-index-file.js +6 -9
  37. package/dist/src/rlc-common/build-index-file.js.map +1 -1
  38. package/dist/src/rlc-common/build-logger.d.ts.map +1 -1
  39. package/dist/src/rlc-common/build-logger.js +0 -4
  40. package/dist/src/rlc-common/build-logger.js.map +1 -1
  41. package/dist/src/rlc-common/helpers/imports-util.d.ts +3 -4
  42. package/dist/src/rlc-common/helpers/imports-util.d.ts.map +1 -1
  43. package/dist/src/rlc-common/helpers/imports-util.js +43 -56
  44. package/dist/src/rlc-common/helpers/imports-util.js.map +1 -1
  45. package/dist/src/rlc-common/helpers/package-util.d.ts +1 -4
  46. package/dist/src/rlc-common/helpers/package-util.d.ts.map +1 -1
  47. package/dist/src/rlc-common/helpers/package-util.js +2 -5
  48. package/dist/src/rlc-common/helpers/package-util.js.map +1 -1
  49. package/dist/src/rlc-common/interfaces.d.ts +1 -6
  50. package/dist/src/rlc-common/interfaces.d.ts.map +1 -1
  51. package/dist/src/rlc-common/interfaces.js.map +1 -1
  52. package/dist/src/rlc-common/metadata/build-es-lint-config.d.ts +1 -1
  53. package/dist/src/rlc-common/metadata/build-es-lint-config.d.ts.map +1 -1
  54. package/dist/src/rlc-common/metadata/build-es-lint-config.js +0 -3
  55. package/dist/src/rlc-common/metadata/build-es-lint-config.js.map +1 -1
  56. package/dist/src/rlc-common/metadata/build-package-file.d.ts.map +1 -1
  57. package/dist/src/rlc-common/metadata/build-package-file.js +6 -12
  58. package/dist/src/rlc-common/metadata/build-package-file.js.map +1 -1
  59. package/dist/src/rlc-common/metadata/build-readme-file.d.ts.map +1 -1
  60. package/dist/src/rlc-common/metadata/build-readme-file.js +1 -2
  61. package/dist/src/rlc-common/metadata/build-readme-file.js.map +1 -1
  62. package/dist/src/rlc-common/metadata/build-rollup-config.d.ts.map +1 -1
  63. package/dist/src/rlc-common/metadata/build-rollup-config.js +1 -2
  64. package/dist/src/rlc-common/metadata/build-rollup-config.js.map +1 -1
  65. package/dist/src/rlc-common/metadata/build-sample-env-file.d.ts.map +1 -1
  66. package/dist/src/rlc-common/metadata/build-sample-env-file.js +1 -2
  67. package/dist/src/rlc-common/metadata/build-sample-env-file.js.map +1 -1
  68. package/dist/src/rlc-common/metadata/package-json/package-common.d.ts +0 -3
  69. package/dist/src/rlc-common/metadata/package-json/package-common.d.ts.map +1 -1
  70. package/dist/src/rlc-common/metadata/package-json/package-common.js +0 -3
  71. package/dist/src/rlc-common/metadata/package-json/package-common.js.map +1 -1
  72. package/dist/src/rlc-common/transform-sample-groups.d.ts.map +1 -1
  73. package/dist/src/rlc-common/transform-sample-groups.js +6 -17
  74. package/dist/src/rlc-common/transform-sample-groups.js.map +1 -1
  75. package/dist/src/transform/transform-helper-function-details.d.ts +2 -2
  76. package/dist/src/transform/transform-helper-function-details.d.ts.map +1 -1
  77. package/dist/src/transform/transform-helper-function-details.js +1 -9
  78. package/dist/src/transform/transform-helper-function-details.js.map +1 -1
  79. package/dist/src/transform/transform.js +2 -2
  80. package/dist/src/transform/transform.js.map +1 -1
  81. package/dist/src/transform/transfrom-rlc-options.d.ts.map +1 -1
  82. package/dist/src/transform/transfrom-rlc-options.js +17 -44
  83. package/dist/src/transform/transfrom-rlc-options.js.map +1 -1
  84. package/dist/src/utils/emit-util.d.ts.map +1 -1
  85. package/dist/src/utils/emit-util.js +6 -9
  86. package/dist/src/utils/emit-util.js.map +1 -1
  87. package/dist/tsconfig.tsbuildinfo +1 -1
  88. package/package.json +7 -18
  89. package/src/framework/load-static-helpers.ts +1 -13
  90. package/src/index.ts +21 -42
  91. package/src/lib.ts +2 -14
  92. package/src/modular/build-client-context.ts +6 -14
  93. package/src/modular/build-root-index.ts +4 -7
  94. package/src/modular/emit-logger-file.ts +0 -3
  95. package/src/modular/emit-samples.ts +7 -22
  96. package/src/modular/helpers/client-helpers.ts +7 -17
  97. package/src/modular/helpers/example-value-helpers.ts +7 -22
  98. package/src/modular/helpers/operation-helpers.ts +1 -1
  99. package/src/rlc-common/build-client.ts +16 -25
  100. package/src/rlc-common/build-index-file.ts +6 -9
  101. package/src/rlc-common/build-logger.ts +0 -4
  102. package/src/rlc-common/helpers/imports-util.ts +44 -56
  103. package/src/rlc-common/helpers/package-util.ts +3 -7
  104. package/src/rlc-common/interfaces.ts +1 -8
  105. package/src/rlc-common/metadata/build-es-lint-config.ts +0 -3
  106. package/src/rlc-common/metadata/build-package-file.ts +6 -18
  107. package/src/rlc-common/metadata/build-readme-file.ts +1 -2
  108. package/src/rlc-common/metadata/build-rollup-config.ts +1 -2
  109. package/src/rlc-common/metadata/build-sample-env-file.ts +1 -4
  110. package/src/rlc-common/metadata/package-json/package-common.ts +0 -4
  111. package/src/rlc-common/transform-sample-groups.ts +7 -22
  112. package/src/transform/transform-helper-function-details.ts +1 -10
  113. package/src/transform/transform.ts +2 -2
  114. package/src/transform/transfrom-rlc-options.ts +17 -51
  115. package/src/utils/emit-util.ts +6 -20
  116. package/dist/src/rlc-common/metadata/package-json/build-flavorless-package.d.ts +0 -57
  117. package/dist/src/rlc-common/metadata/package-json/build-flavorless-package.d.ts.map +0 -1
  118. package/dist/src/rlc-common/metadata/package-json/build-flavorless-package.js +0 -53
  119. package/dist/src/rlc-common/metadata/package-json/build-flavorless-package.js.map +0 -1
  120. package/src/rlc-common/metadata/package-json/build-flavorless-package.ts +0 -68
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@azure-tools/typespec-ts",
3
- "version": "0.55.0-dev.4",
3
+ "version": "0.55.0-dev.5",
4
4
  "description": "An experimental TypeSpec emitter for TypeScript RLC",
5
5
  "main": "dist/src/index.js",
6
6
  "type": "module",
@@ -23,9 +23,9 @@
23
23
  "@typespec/spec-api": "^0.1.0-alpha.14 || >=0.1.0-alpha.15-dev <0.1.0-alpha.15",
24
24
  "@typespec/tspd": "^0.75.0 || >=0.76.0-dev <0.76.0",
25
25
  "@azure-tools/azure-http-specs": "^0.1.0-alpha.42 || >=0.1.0-alpha.43-dev <0.1.0-alpha.43",
26
- "@azure-tools/typespec-autorest": "^0.69.0 || >=0.70.0-dev <0.70.0",
26
+ "@azure-tools/typespec-autorest": "^0.69.1 || >=0.70.0-dev <0.70.0",
27
27
  "@azure-tools/typespec-azure-core": "^0.69.0 || >=0.70.0-dev <0.70.0",
28
- "@azure-tools/typespec-azure-resource-manager": "^0.69.0 || >=0.70.0-dev <0.70.0",
28
+ "@azure-tools/typespec-azure-resource-manager": "^0.69.1 || >=0.70.0-dev <0.70.0",
29
29
  "@azure-tools/typespec-client-generator-core": "^0.69.0 || >=0.70.0-dev <0.70.0",
30
30
  "@azure/abort-controller": "^2.1.2",
31
31
  "@azure/core-auth": "^1.6.0",
@@ -91,37 +91,26 @@
91
91
  "build": "tsc -p .",
92
92
  "test": "npm run test-next && npm run unit-test && npm run integration-test-ci",
93
93
  "test:azure": "npm run test-next && npm run copy:typespec && npm run integration-test-ci:azure-rlc && npm run integration-test-ci:azure-modular",
94
- "test:standard": "npm run test-next && npm run copy:typespec && npm run unit-test&& npm run integration-test-ci:rlc && npm run integration-test-ci:modular",
95
94
  "lint": "eslint . --ext .ts --max-warnings=0",
96
95
  "lint:fix": "eslint . --fix --ext .ts",
97
96
  "check:tree": "tsx ./test/commands/check-clean-tree.ts",
98
97
  "test:ts:e2e": "npm run copy:typespec && npm run integration-test-ci:azure-rlc && npm run integration-test-ci:azure-modular",
99
- "integration-test-ci": "npm-run-all copy:typespec integration-test-ci:rlc integration-test-ci:azure-rlc integration-test-ci:modular integration-test-ci:azure-modular",
100
- "integration-test-ci:sequential": "npm-run-all --serial copy:typespec integration-test-ci:modular && npm run integration-test-ci:modular",
101
- "integration-test-ci:rlc": "npm-run-all --silent -p start-test-server:rlc --race generate-and-run:rlc",
98
+ "integration-test-ci": "npm-run-all copy:typespec integration-test-ci:azure-rlc integration-test-ci:azure-modular",
99
+ "integration-test-ci:sequential": "npm-run-all --serial copy:typespec integration-test-ci:azure-modular && npm run integration-test-ci:azure-modular",
102
100
  "integration-test-ci:azure-rlc": "npm-run-all --silent -p start-test-server:azure-rlc --race generate-and-run:azure-rlc",
103
- "integration-test-ci:modular": "npm-run-all --silent -p start-test-server:modular --race generate-and-run:modular",
104
101
  "integration-test-ci:azure-modular": "npm-run-all --silent -p start-test-server:azure-modular --race generate-and-run:azure-modular",
105
102
  "start-test-server": "mkdirp -p coverage && npx tsp-spector serve ./node_modules/@typespec/http-specs/specs --coverageFile ./coverage/spector-coverage-typescript.json",
106
- "start-test-server:rlc": "mkdirp -p coverage && npx tsp-spector serve ./node_modules/@typespec/http-specs/specs --coverageFile ./coverage/spector-coverage-typescript-rlc-standard.json",
107
103
  "start-test-server:azure-rlc": "mkdirp -p coverage && npx tsp-spector serve ./node_modules/@azure-tools/azure-http-specs/specs ./node_modules/@typespec/http-specs/specs --coverageFile ./coverage/spector-coverage-typescript-rlc-azure.json",
108
- "start-test-server:modular": "mkdirp -p coverage && npx tsp-spector serve ./node_modules/@typespec/http-specs/specs --port 3002 --coverageFile ./coverage/spector-coverage-typescript-modular-standard.json",
109
104
  "start-test-server:azure-modular": "mkdirp -p coverage && npx tsp-spector serve ./node_modules/@azure-tools/azure-http-specs/specs ./node_modules/@typespec/http-specs/specs --port 3002 --coverageFile ./coverage/spector-coverage-typescript-modular-azure.json",
110
105
  "copy:typespec": "rm -rf temp && mkdirp -p temp/specs && mkdirp -p temp/assets && cp -r ./node_modules/@typespec/http-specs/specs/* ./temp/specs && cp -r ./node_modules/@azure-tools/azure-http-specs/specs/* ./temp/specs && cp -r ./test/integration/typespec/* ./temp/specs && cp -r ./node_modules/@typespec/http-specs/assets/* ./temp/assets",
111
- "generate-and-run:rlc": "npm run generate-tsp-only:rlc && npm run integration-test:alone:rlc && npm run stop-test-server -- -p 3000",
112
106
  "generate-and-run:azure-rlc": "npm run generate-tsp-only:azure-rlc && npm run integration-test:alone:azure-rlc && npm run stop-test-server -- -p 3000",
113
- "generate-and-run:modular": "npm run generate-tsp-only:modular && npm run integration-test:alone:modular && npm run stop-test-server -- -p 3002",
114
107
  "generate-and-run:azure-modular": "npm run generate-tsp-only:azure-modular && npm run integration-test:alone:azure-modular && npm run stop-test-server -- -p 3002",
115
- "generate-tsp-only": "npm run generate-tsp-only:azure-rlc && npm run generate-tsp-only:rlc &&npm run generate-tsp-only:azure-modular && npm run generate-tsp-only:modular",
116
- "generate-tsp-only:rlc": "npx tsx ./test/commands/gen-spector.js --tag=rlc",
108
+ "generate-tsp-only": "npm run generate-tsp-only:azure-rlc && npm run generate-tsp-only:azure-modular",
117
109
  "generate-tsp-only:azure-rlc": "npx tsx ./test/commands/gen-spector.js --tag=azure-rlc",
118
- "generate-tsp-only:modular": "npx tsx ./test/commands/gen-spector.js --tag=modular",
119
110
  "generate-tsp-only:azure-modular": "npx tsx ./test/commands/gen-spector.js --tag=azure-modular",
120
111
  "regen-test-baselines": "npm run generate-tsp-only",
121
- "integration-test:alone": "npm run integration-test:alone:rlc && npm run integration-test:alone:azure-rlc && npm run integration-test:alone:modular && npm run integration-test:alone:azure-modular",
122
- "integration-test:alone:rlc": "vitest run --project integration-rlc",
112
+ "integration-test:alone": "npm run integration-test:alone:azure-rlc && npm run integration-test:alone:azure-modular",
123
113
  "integration-test:alone:azure-rlc": "vitest run --project integration-azure-rlc",
124
- "integration-test:alone:modular": "vitest run --project integration-modular",
125
114
  "integration-test:alone:azure-modular": "vitest run --project integration-azure-modular",
126
115
  "stop-test-server": "npx tsp-spector server stop",
127
116
  "unit-test": "npm-run-all --parallel unit-test:rlc unit-test:modular",
@@ -10,7 +10,6 @@ import {
10
10
  } from "ts-morph";
11
11
  import { reportDiagnostic } from "../lib.js";
12
12
  import { ModularEmitterOptions } from "../modular/interfaces.js";
13
- import { isAzurePackage } from "../rlc-common/index.js";
14
13
  import { resolveProjectRoot } from "../utils/resolve-project-root.js";
15
14
  import { refkey } from "./refkey.js";
16
15
  export const SourceFileSymbol = Symbol("SourceFile");
@@ -73,10 +72,7 @@ export async function loadStaticHelpers(
73
72
  );
74
73
  await loadFiles(filesInSources, options.sourcesDir ?? "");
75
74
  // Load static helpers used in testing code (only when loadTestHelpers is enabled)
76
- if (
77
- options.loadTestHelpers ??
78
- (options.options?.generateTest && isAzurePackage({ options: options.options }))
79
- ) {
75
+ if (options.loadTestHelpers ?? options.options?.generateTest) {
80
76
  const defaultTestingHelpersPath = joinPaths(packageRoot, DEFAULT_SOURCES_TESTING_HELPERS_PATH);
81
77
  const filesInTestings = await traverseDirectory(
82
78
  defaultTestingHelpersPath,
@@ -99,14 +95,6 @@ export async function loadStaticHelpers(
99
95
  overwrite: true,
100
96
  });
101
97
  addedFile.getImportDeclarations().map((i) => {
102
- if (!isAzurePackage({ options: options.options })) {
103
- if (i.getModuleSpecifier().getFullText().includes("@azure/core-rest-pipeline")) {
104
- i.setModuleSpecifier("@typespec/ts-http-runtime");
105
- }
106
- if (i.getModuleSpecifier().getFullText().includes("@azure-rest/core-client")) {
107
- i.setModuleSpecifier("@typespec/ts-http-runtime");
108
- }
109
- }
110
98
  // Rewrite relative platform-types imports to #platform/ specifiers
111
99
  // so that browser/react-native variants are resolved via subpath imports.
112
100
  // Only rewrite imports to the default variant (not -browser/-react-native variants
package/src/index.ts CHANGED
@@ -17,7 +17,6 @@ import {
17
17
  AzureIdentityDependencies,
18
18
  AzurePollingDependencies,
19
19
  AzureTestDependencies,
20
- DefaultCoreDependencies,
21
20
  } from "./modular/external-dependencies.js";
22
21
  import {
23
22
  CloudSettingHelpers,
@@ -73,7 +72,6 @@ import {
73
72
  getClientName,
74
73
  hasClientNameChanged,
75
74
  hasUnexpectedHelper,
76
- isAzurePackage,
77
75
  updatePackageFile,
78
76
  updateReadmeFile,
79
77
  } from "./rlc-common/index.js";
@@ -178,14 +176,12 @@ export async function $onEmit(context: EmitContext) {
178
176
  packageRoot: emitterPackageRoot,
179
177
  },
180
178
  );
181
- const extraDependencies = isAzurePackage({ options: rlcOptions })
182
- ? {
183
- ...AzurePollingDependencies,
184
- ...AzureCoreDependencies,
185
- ...AzureIdentityDependencies,
186
- ...AzureTestDependencies,
187
- }
188
- : { ...DefaultCoreDependencies };
179
+ const extraDependencies = {
180
+ ...AzurePollingDependencies,
181
+ ...AzureCoreDependencies,
182
+ ...AzureIdentityDependencies,
183
+ ...AzureTestDependencies,
184
+ };
189
185
  const binder = provideBinder(outputProject, {
190
186
  staticHelpers,
191
187
  dependencies: {
@@ -241,8 +237,7 @@ export async function $onEmit(context: EmitContext) {
241
237
  options.generateTest =
242
238
  options.generateTest === true ||
243
239
  (options.generateTest === undefined &&
244
- (!hasTestFolder || (options.azureSdkForJs && options.azureArm)) &&
245
- isAzurePackage({ options: options }));
240
+ (!hasTestFolder || (options.azureSdkForJs && options.azureArm)));
246
241
  dpgContext.rlcOptions = options;
247
242
  }
248
243
 
@@ -471,7 +466,6 @@ export async function $onEmit(context: EmitContext) {
471
466
  // warp.config.yml, and snippets.spec.ts. metadata.json is still updated.
472
467
  const sourcesDir = dpgContext.generationPathDetail?.modularSourcesDir ?? "";
473
468
  const hasManualConvenienceLayer = getBaseFileName(sourcesDir) === "generated";
474
- const isAzureFlavor = isAzurePackage({ options: option });
475
469
  // Generate metadata
476
470
  const existingPackageFilePath = joinPaths(
477
471
  dpgContext.generationPathDetail?.metadataDir ?? "",
@@ -523,9 +517,7 @@ export async function $onEmit(context: EmitContext) {
523
517
  commonBuilders.push((model) => buildTestBrowserTsConfig(model));
524
518
  commonBuilders.push((model) => buildTestNodeTsConfig(model));
525
519
  }
526
- if (isAzureFlavor) {
527
- commonBuilders.push(buildEsLintConfig);
528
- }
520
+ commonBuilders.push(buildEsLintConfig);
529
521
  if (!hasChangelogFile) {
530
522
  commonBuilders.push(buildChangelogFile);
531
523
  }
@@ -543,25 +535,16 @@ export async function $onEmit(context: EmitContext) {
543
535
  };
544
536
  // Build dependencies
545
537
  const dependencies: Record<string, string> = {};
546
- if (isAzureFlavor) {
547
- dependencies["@azure/core-util"] = "^1.9.2";
548
- }
538
+ dependencies["@azure/core-util"] = "^1.9.2";
549
539
  // Add fast-xml-parser if XML serialization is used
550
540
  if (packageUsesXmlSerialization(dpgContext.sdkPackage)) {
551
541
  dependencies["fast-xml-parser"] = "^4.5.0";
552
542
  }
553
- if (isAzureFlavor) {
554
- modularPackageInfo = {
555
- ...modularPackageInfo,
556
- dependencies,
557
- clientContextPaths: getRelativeContextPaths(context, modularEmitterOptions),
558
- };
559
- } else if (Object.keys(dependencies).length > 0) {
560
- modularPackageInfo = {
561
- ...modularPackageInfo,
562
- dependencies,
563
- };
564
- }
543
+ modularPackageInfo = {
544
+ ...modularPackageInfo,
545
+ dependencies,
546
+ clientContextPaths: getRelativeContextPaths(context, modularEmitterOptions),
547
+ };
565
548
  }
566
549
  commonBuilders.push((model) => buildPackageFile(model, modularPackageInfo));
567
550
  // Generate warp.config.yml for Azure monorepo ESM packages
@@ -579,9 +562,7 @@ export async function $onEmit(context: EmitContext) {
579
562
  if (option.generateSample) {
580
563
  commonBuilders.push(buildTsSampleConfig);
581
564
  }
582
- if (isAzureFlavor) {
583
- commonBuilders.push(buildTsLintConfig);
584
- }
565
+ commonBuilders.push(buildTsLintConfig);
585
566
  }
586
567
 
587
568
  // TODO: need support snippets generation for multi-client cases. https://github.com/Azure/autorest.typescript/issues/3048
@@ -683,14 +664,12 @@ export async function $onEmit(context: EmitContext) {
683
664
  dpgContext.generationPathDetail?.metadataDir,
684
665
  );
685
666
  }
686
- if (isAzureFlavor) {
687
- await emitContentByBuilder(
688
- program,
689
- buildMetadataJson,
690
- rlcClient,
691
- dpgContext.generationPathDetail?.metadataDir,
692
- );
693
- }
667
+ await emitContentByBuilder(
668
+ program,
669
+ buildMetadataJson,
670
+ rlcClient,
671
+ dpgContext.generationPathDetail?.metadataDir,
672
+ );
694
673
 
695
674
  // Generate test relevant files
696
675
  if (option.generateTest && !hasTestFolder) {
package/src/lib.ts CHANGED
@@ -3,7 +3,7 @@
3
3
 
4
4
  import { createTypeSpecLibrary, JSONSchemaType, paramMessage } from "@typespec/compiler";
5
5
  import { Options } from "prettier";
6
- import { DependencyInfo, PackageDetails, PackageFlavor, ServiceInfo } from "./rlc-common/index.js";
6
+ import { DependencyInfo, PackageDetails, ServiceInfo } from "./rlc-common/index.js";
7
7
 
8
8
  export interface EmitterOptions {
9
9
  /**
@@ -54,7 +54,6 @@ export interface EmitterOptions {
54
54
  "is-modular-library"?: boolean;
55
55
  "module-kind"?: "esm";
56
56
  "enable-operation-group"?: boolean;
57
- flavor?: PackageFlavor;
58
57
  "enable-model-namespace"?: boolean;
59
58
  "hierarchy-client"?: boolean;
60
59
  "compatibility-mode"?: boolean;
@@ -63,7 +62,6 @@ export interface EmitterOptions {
63
62
  "clear-output-folder"?: boolean;
64
63
  "ignore-property-name-normalize"?: boolean;
65
64
  "compatibility-query-multi-format"?: boolean;
66
- branded?: boolean;
67
65
  "typespec-title-map"?: Record<string, string>;
68
66
  "ignore-enum-member-name-normalize"?: boolean;
69
67
  "default-value-object"?: boolean;
@@ -210,7 +208,7 @@ export const RLCOptionsSchema: JSONSchemaType<EmitterOptions> = {
210
208
  type: "boolean",
211
209
  nullable: true,
212
210
  description:
213
- "This is used to indicate your project is generated in [azure-sdk-for-js](https://github.com/Azure/azure-sdk-for-js) repo or not. If your package is located in that repo we'll leverage `dev-tool` to accelerate our building and testing, however if not we'll remove the dependency for that tool. Defaults to `undefined`. Services with Flavor equal to 'Azure' default to 'true'. ",
211
+ "This is used to indicate your project is generated in [azure-sdk-for-js](https://github.com/Azure/azure-sdk-for-js) repo or not. If your package is located in that repo we'll leverage `dev-tool` to accelerate our building and testing, however if not we'll remove the dependency for that tool. Defaults to `undefined`. ",
214
212
  },
215
213
  "azure-output-directory": {
216
214
  type: "string",
@@ -288,16 +286,6 @@ export const RLCOptionsSchema: JSONSchemaType<EmitterOptions> = {
288
286
  description:
289
287
  "An option to organize the client in a hierarchical way as defined by `@clientInitialization`. This is true by default.",
290
288
  },
291
- branded: {
292
- type: "boolean",
293
- nullable: true,
294
- description: "A section of flavor",
295
- },
296
- flavor: {
297
- type: "string",
298
- nullable: true,
299
- description: "The flavor of the SDK.",
300
- },
301
289
  "module-kind": {
302
290
  type: "string",
303
291
  nullable: true,
@@ -1,4 +1,4 @@
1
- import { NameType, isAzurePackage, normalizeName } from "../rlc-common/index.js";
1
+ import { NameType, normalizeName } from "../rlc-common/index.js";
2
2
  import {
3
3
  buildGetClientCredentialParam,
4
4
  buildGetClientEndpointParam,
@@ -164,13 +164,10 @@ export function buildClientContext(
164
164
  });
165
165
 
166
166
  // TODO use binder here
167
- // (for now) now logger for unbranded pkgs
168
- if (isAzurePackage(emitterOptions)) {
169
- clientContextFile.addImportDeclaration({
170
- moduleSpecifier: "../".repeat(hierarchy.length + 1) + "logger.js",
171
- namedImports: ["logger"],
172
- });
173
- }
167
+ clientContextFile.addImportDeclaration({
168
+ moduleSpecifier: "../".repeat(hierarchy.length + 1) + "logger.js",
169
+ namedImports: ["logger"],
170
+ });
174
171
 
175
172
  const factoryFunction = clientContextFile.addFunction({
176
173
  docs: getDocsFromDescription(client.doc),
@@ -241,15 +238,10 @@ export function buildClientContext(
241
238
  if (!apiVersionInEndpoint && apiVersionParam.clientDefaultValue) {
242
239
  apiVersionStatement += `const ${apiVersionParamName} = options.${apiVersionParamName};`;
243
240
  }
244
- } else if (isAzurePackage(emitterOptions)) {
245
- apiVersionStatement += `
246
- if (options.apiVersion) {
247
- logger.warning("This client does not support client api-version, please change it at the operation level");
248
- }`;
249
241
  } else {
250
242
  apiVersionStatement += `
251
243
  if (options.apiVersion) {
252
- console.warn("This client does not support client api-version, please change it at the operation level");
244
+ logger.warning("This client does not support client api-version, please change it at the operation level");
253
245
  }`;
254
246
  }
255
247
  factoryFunction.addStatements(apiVersionStatement);
@@ -4,7 +4,7 @@ import { Project, SourceFile } from "ts-morph";
4
4
  import { useContext } from "../context-manager.js";
5
5
  import { resolveReference } from "../framework/reference.js";
6
6
  import { reportDiagnostic } from "../lib.js";
7
- import { isAzurePackage, NameType, normalizeName } from "../rlc-common/index.js";
7
+ import { NameType, normalizeName } from "../rlc-common/index.js";
8
8
  import { getModularClientOptions } from "../utils/client-utils.js";
9
9
  import { SdkContext } from "../utils/interfaces.js";
10
10
  import { getMethodHierarchiesMap } from "../utils/operation-util.js";
@@ -28,7 +28,7 @@ export function buildRootIndex(
28
28
  if (!clientMap) {
29
29
  // we still need to export the models if no client is provided
30
30
  exportModels(emitterOptions, rootIndexFile);
31
- exportRestErrorTypes(context, rootIndexFile);
31
+ exportRestErrorTypes(rootIndexFile);
32
32
  return;
33
33
  }
34
34
  const project = useContext("outputProject");
@@ -71,7 +71,7 @@ export function buildRootIndex(
71
71
  exportPagingTypes(context, rootIndexFile);
72
72
  exportFileContentsType(context, rootIndexFile);
73
73
  exportAzureCloudTypes(context, rootIndexFile);
74
- exportRestErrorTypes(context, rootIndexFile);
74
+ exportRestErrorTypes(rootIndexFile);
75
75
  }
76
76
 
77
77
  function exportModels(
@@ -105,10 +105,7 @@ function exportAzureCloudTypes(context: SdkContext, rootIndexFile: SourceFile) {
105
105
  }
106
106
  }
107
107
 
108
- function exportRestErrorTypes(context: SdkContext, rootIndexFile: SourceFile) {
109
- if (!isAzurePackage({ options: context.rlcOptions })) {
110
- return;
111
- }
108
+ function exportRestErrorTypes(rootIndexFile: SourceFile) {
112
109
  const existingExports = getExistingExports(rootIndexFile);
113
110
  const namedExports = ["RestError", "isRestError"].filter((name) => !existingExports.has(name));
114
111
  if (namedExports.length > 0) {
@@ -3,9 +3,6 @@ import { ModularEmitterOptions } from "./interfaces.js";
3
3
 
4
4
  export function emitLoggerFile(emitterOptions: ModularEmitterOptions, srcPath: string = "src") {
5
5
  const project = useContext("outputProject");
6
- if (emitterOptions.options.flavor !== "azure") {
7
- return;
8
- }
9
6
 
10
7
  const sourceFile = project.createSourceFile(`${srcPath}/logger.ts`, "", {
11
8
  overwrite: true,
@@ -14,7 +14,7 @@ import { useContext } from "../context-manager.js";
14
14
  import { resolveReference } from "../framework/reference.js";
15
15
  import { reportDiagnostic } from "../index.js";
16
16
  import { AzureIdentityDependencies } from "../modular/external-dependencies.js";
17
- import { isAzurePackage, NameType, normalizeName } from "../rlc-common/index.js";
17
+ import { NameType, normalizeName } from "../rlc-common/index.js";
18
18
  import { getSubscriptionId } from "../transform/transfrom-rlc-options.js";
19
19
  import { hasKeyCredential, hasTokenCredential } from "../utils/credential-utils.js";
20
20
  import { SdkContext } from "../utils/interfaces.js";
@@ -464,7 +464,7 @@ function prepareExampleParameters(
464
464
  }
465
465
 
466
466
  function getCredentialExampleValue(
467
- dpgContext: SdkContext,
467
+ _dpgContext: SdkContext,
468
468
  initialization: SdkClientInitializationType,
469
469
  ): ExampleValue | undefined {
470
470
  const keyCredential = hasKeyCredential(initialization),
@@ -475,26 +475,11 @@ function getCredentialExampleValue(
475
475
  name: "credential",
476
476
  };
477
477
  if (keyCredential || tokenCredential) {
478
- if (isAzurePackage({ options: dpgContext.rlcOptions })) {
479
- // Support DefaultAzureCredential for Azure packages
480
- return {
481
- ...defaultSetting,
482
- value: `new ${resolveReference(AzureIdentityDependencies.DefaultAzureCredential)}()`,
483
- };
484
- } else if (keyCredential) {
485
- // Support ApiKeyCredential for non-Azure packages
486
- return {
487
- ...defaultSetting,
488
- value: `{ key: "INPUT_YOUR_KEY_HERE" }`,
489
- };
490
- } else if (tokenCredential) {
491
- // Support TokenCredential for non-Azure packages
492
- return {
493
- ...defaultSetting,
494
- value: `{ getToken: async () => {
495
- return { token: "INPUT_YOUR_TOKEN_HERE", expiresOnTimestamp: now() }; } }`,
496
- };
497
- }
478
+ // Support DefaultAzureCredential for Azure packages
479
+ return {
480
+ ...defaultSetting,
481
+ value: `new ${resolveReference(AzureIdentityDependencies.DefaultAzureCredential)}()`,
482
+ };
498
483
  }
499
484
  return undefined;
500
485
  }
@@ -10,7 +10,7 @@ import { OptionalKind, ParameterDeclarationStructure, StatementedNode } from "ts
10
10
  import { ModularEmitterOptions } from "../interfaces.js";
11
11
 
12
12
  import { resolveReference } from "../../framework/reference.js";
13
- import { NameType, normalizeName, PackageFlavor } from "../../rlc-common/index.js";
13
+ import { NameType, normalizeName } from "../../rlc-common/index.js";
14
14
  import { SdkContext } from "../../utils/interfaces.js";
15
15
  import { CloudSettingHelpers } from "../static-helpers-metadata.js";
16
16
  import { getTypeExpression } from "../type-expressions/get-type-expression.js";
@@ -169,16 +169,10 @@ export function buildGetClientEndpointParam(
169
169
  client: SdkClientType<SdkServiceOperation>,
170
170
  ): { endpointParamName: string; assignedOptionalParams?: Set<string> } {
171
171
  const assignedOptionalParams = new Set<string>();
172
- let coreEndpointParam: string;
173
- if (dpgContext.rlcOptions?.flavor === "azure") {
174
- const cloudSettingSuffix = dpgContext.arm
175
- ? ` ?? ${resolveReference(CloudSettingHelpers.getArmEndpoint)}(options.cloudSetting)`
176
- : "";
177
- coreEndpointParam = `options.endpoint${cloudSettingSuffix}`;
178
- } else {
179
- // unbranded does not have the deprecated baseUrl parameter
180
- coreEndpointParam = `options.endpoint`;
181
- }
172
+ const cloudSettingSuffix = dpgContext.arm
173
+ ? ` ?? ${resolveReference(CloudSettingHelpers.getArmEndpoint)}(options.cloudSetting)`
174
+ : "";
175
+ const coreEndpointParam = `options.endpoint${cloudSettingSuffix}`;
182
176
  // Special case: endpoint URL not defined
183
177
  const endpointParam = getClientParameters(client, dpgContext, {
184
178
  onClientOnly: true,
@@ -248,7 +242,7 @@ export function buildGetClientOptionsParam(
248
242
  apiVersionParamName?: string,
249
243
  ): string {
250
244
  const userAgentOptions = buildUserAgentOptions(context, emitterOptions, "azsdk-js-api");
251
- const loggingOptions = buildLoggingOptions(emitterOptions.options.flavor);
245
+ const loggingOptions = buildLoggingOptions();
252
246
  const credentials = buildCredentials(emitterOptions, endpointParam);
253
247
 
254
248
  // Use the actual api version parameter name for destructuring, defaulting to "apiVersion"
@@ -315,11 +309,7 @@ function buildCredentials(
315
309
  return `{ ${scopes}${apiKeyHeaderName} }`;
316
310
  }
317
311
 
318
- function buildLoggingOptions(flavor?: PackageFlavor): string | undefined {
319
- if (flavor !== "azure") {
320
- return undefined;
321
- }
322
-
312
+ function buildLoggingOptions(): string | undefined {
323
313
  return `{ logger: options.loggingOptions?.logger ?? logger.info }`;
324
314
  }
325
315
 
@@ -12,7 +12,7 @@ import { joinPaths } from "@typespec/compiler";
12
12
  import { SourceFile } from "ts-morph";
13
13
  import { useContext } from "../../context-manager.js";
14
14
  import { resolveReference } from "../../framework/reference.js";
15
- import { isAzurePackage, NameType, normalizeName } from "../../rlc-common/index.js";
15
+ import { NameType, normalizeName } from "../../rlc-common/index.js";
16
16
  import { getSubscriptionId } from "../../transform/transfrom-rlc-options.js";
17
17
  import { hasKeyCredential, hasTokenCredential } from "../../utils/credential-utils.js";
18
18
  import { SdkContext } from "../../utils/interfaces.js";
@@ -73,7 +73,7 @@ export function prepareCommonValue(
73
73
  * Get credential value for samples
74
74
  */
75
75
  export function getCredentialSampleValue(
76
- dpgContext: SdkContext,
76
+ _dpgContext: SdkContext,
77
77
  initialization: SdkClientInitializationType,
78
78
  ): CommonValue | undefined {
79
79
  const keyCredential = hasKeyCredential(initialization),
@@ -84,26 +84,11 @@ export function getCredentialSampleValue(
84
84
  name: "credential",
85
85
  };
86
86
  if (keyCredential || tokenCredential) {
87
- if (isAzurePackage({ options: dpgContext.rlcOptions })) {
88
- // Support DefaultAzureCredential for Azure packages
89
- return {
90
- ...defaultSetting,
91
- value: `new ${resolveReference(AzureIdentityDependencies.DefaultAzureCredential)}()`,
92
- };
93
- } else if (keyCredential) {
94
- // Support ApiKeyCredential for non-Azure packages
95
- return {
96
- ...defaultSetting,
97
- value: `{ key: "INPUT_YOUR_KEY_HERE" }`,
98
- };
99
- } else if (tokenCredential) {
100
- // Support TokenCredential for non-Azure packages
101
- return {
102
- ...defaultSetting,
103
- value: `{ getToken: async () => {
104
- return { token: "INPUT_YOUR_TOKEN_HERE", expiresOnTimestamp: Date.now() }; } }`,
105
- };
106
- }
87
+ // Support DefaultAzureCredential for Azure packages
88
+ return {
89
+ ...defaultSetting,
90
+ value: `new ${resolveReference(AzureIdentityDependencies.DefaultAzureCredential)}()`,
91
+ };
107
92
  }
108
93
  return undefined;
109
94
  }
@@ -2060,7 +2060,7 @@ function getSerializationExpressionForFlatten(
2060
2060
  );
2061
2061
  const optionalPrefix = property.optional
2062
2062
  ? `${resolveReference(SerializationHelpers.areAllPropsUndefined)}(${propertyPath}, [${validProps
2063
- .map((p) => `"${p.name}"`)
2063
+ .map((p) => normalizeModelPropertyName(context, p))
2064
2064
  .join(", ")}]) ? undefined : `
2065
2065
  : "";
2066
2066
  return `${optionalPrefix}${serializeFunctionName}(${propertyPath})`;
@@ -16,7 +16,6 @@ import { buildMethodShortcutImplementation } from "./build-method-shortcuts.js";
16
16
  import { getImportSpecifier } from "./helpers/imports-util.js";
17
17
  import { getClientName, getImportModuleName } from "./helpers/name-constructors.js";
18
18
  import { NameType, normalizeName } from "./helpers/name-utils.js";
19
- import { isAzurePackage } from "./helpers/package-util.js";
20
19
  import { File, PathParameter, RLCModel } from "./interfaces.js";
21
20
 
22
21
  function getClientOptionsInterface(
@@ -192,20 +191,18 @@ export function buildClient(model: RLCModel): File | undefined {
192
191
  moduleSpecifier: getImportSpecifier("restClient", model.importInfo.runtimeImports),
193
192
  },
194
193
  ]);
195
- if (isAzurePackage(model)) {
196
- clientFile.addImportDeclarations([
197
- {
198
- namedImports: ["logger"],
199
- moduleSpecifier: getImportModuleName(
200
- {
201
- cjsName: loggerPath,
202
- esModulesName: `${loggerPath}.js`,
203
- },
204
- model,
205
- ),
206
- },
207
- ]);
208
- }
194
+ clientFile.addImportDeclarations([
195
+ {
196
+ namedImports: ["logger"],
197
+ moduleSpecifier: getImportModuleName(
198
+ {
199
+ cjsName: loggerPath,
200
+ esModulesName: `${loggerPath}.js`,
201
+ },
202
+ model,
203
+ ),
204
+ },
205
+ ]);
209
206
 
210
207
  const includeKeyCredentialHelper =
211
208
  customHttpAuthHeaderName &&
@@ -349,12 +346,10 @@ export function getClientFactoryBody(
349
346
  const apiKeyHeaderName = credentialKeyHeaderName
350
347
  ? `apiKeyHeaderName: options.credentials?.apiKeyHeaderName ?? "${credentialKeyHeaderName}",`
351
348
  : "";
352
- const loggerOptions = isAzurePackage(model)
353
- ? `,
349
+ const loggerOptions = `,
354
350
  loggingOptions: {
355
351
  logger: options.loggingOptions?.logger ?? logger.info
356
- }`
357
- : "";
352
+ }`;
358
353
 
359
354
  const credentialsOptions =
360
355
  (scopes || apiKeyHeaderName) && addCredentials
@@ -400,16 +395,12 @@ export function getClientFactoryBody(
400
395
  }
401
396
 
402
397
  let apiVersionPolicyStatement = `client.pipeline.removePolicy({ name: "ApiVersionPolicy" });`;
403
- if (isAzurePackage(model) && model.apiVersionInfo?.isCrossedVersion !== false) {
398
+ if (model.apiVersionInfo?.isCrossedVersion !== false) {
404
399
  apiVersionPolicyStatement += `
405
400
  if (options.apiVersion) {
406
401
  logger.warning("This client does not support client api-version, please change it at the operation level");
407
402
  }`;
408
- } else if (
409
- isAzurePackage(model) &&
410
- !model.apiVersionInfo?.defaultValue &&
411
- model.apiVersionInfo?.required
412
- ) {
403
+ } else if (!model.apiVersionInfo?.defaultValue && model.apiVersionInfo?.required) {
413
404
  apiVersionPolicyStatement += `
414
405
  if (options.apiVersion) {
415
406
  logger.warning("This client does not support to set api-version in options, please change it at positional argument");
@@ -17,7 +17,6 @@ import {
17
17
  hasTsvCollection,
18
18
  hasUnexpectedHelper,
19
19
  } from "./helpers/operation-helpers.js";
20
- import { isAzurePackage } from "./helpers/package-util.js";
21
20
  import { RLCModel } from "./interfaces.js";
22
21
 
23
22
  export function buildIndexFile(model: RLCModel) {
@@ -328,14 +327,12 @@ function generateRLCIndex(file: SourceFile, model: RLCModel) {
328
327
  ]);
329
328
  }
330
329
 
331
- if (isAzurePackage(model)) {
332
- file.addExportDeclarations([
333
- {
334
- moduleSpecifier: "@azure/core-rest-pipeline",
335
- namedExports: ["RestError", "isRestError"],
336
- },
337
- ]);
338
- }
330
+ file.addExportDeclarations([
331
+ {
332
+ moduleSpecifier: "@azure/core-rest-pipeline",
333
+ namedExports: ["RestError", "isRestError"],
334
+ },
335
+ ]);
339
336
 
340
337
  file.addExportAssignment({
341
338
  expression: createClientFuncName,
@@ -9,10 +9,6 @@ export function buildLogger(model: RLCModel) {
9
9
  if (!model.options) {
10
10
  return undefined;
11
11
  }
12
- // Disable logger for non-Azure packages
13
- if (model.options.flavor !== "azure") {
14
- return undefined;
15
- }
16
12
  const project = new Project({ useInMemoryFileSystem: true });
17
13
  const { srcPath, rlcSourceDir } = model;
18
14
  const { packageDetails } = model.options;