@azure-tools/typespec-ts 0.55.0-dev.8 → 0.55.0

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 (192) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/README.md +1 -77
  3. package/dist/src/framework/hooks/sdk-types.d.ts +3 -2
  4. package/dist/src/framework/hooks/sdk-types.d.ts.map +1 -1
  5. package/dist/src/framework/hooks/sdk-types.js +3 -2
  6. package/dist/src/framework/hooks/sdk-types.js.map +1 -1
  7. package/dist/src/index.d.ts.map +1 -1
  8. package/dist/src/index.js +24 -80
  9. package/dist/src/index.js.map +1 -1
  10. package/dist/src/lib.d.ts +2 -12
  11. package/dist/src/lib.d.ts.map +1 -1
  12. package/dist/src/lib.js +0 -65
  13. package/dist/src/lib.js.map +1 -1
  14. package/dist/src/modular/build-classical-client.js +2 -2
  15. package/dist/src/modular/build-classical-client.js.map +1 -1
  16. package/dist/src/modular/emit-models.d.ts.map +1 -1
  17. package/dist/src/modular/emit-models.js +19 -5
  18. package/dist/src/modular/emit-models.js.map +1 -1
  19. package/dist/src/modular/emit-samples.js +92 -19
  20. package/dist/src/modular/emit-samples.js.map +1 -1
  21. package/dist/src/modular/serialization/serialize-utils.js +2 -2
  22. package/dist/src/modular/serialization/serialize-utils.js.map +1 -1
  23. package/dist/src/rlc-common/helpers/name-constructors.d.ts.map +1 -1
  24. package/dist/src/rlc-common/helpers/name-constructors.js +1 -7
  25. package/dist/src/rlc-common/helpers/name-constructors.js.map +1 -1
  26. package/dist/src/rlc-common/index.d.ts +0 -16
  27. package/dist/src/rlc-common/index.d.ts.map +1 -1
  28. package/dist/src/rlc-common/index.js +0 -16
  29. package/dist/src/rlc-common/index.js.map +1 -1
  30. package/dist/src/rlc-common/interfaces.d.ts +0 -10
  31. package/dist/src/rlc-common/interfaces.d.ts.map +1 -1
  32. package/dist/src/rlc-common/interfaces.js.map +1 -1
  33. package/dist/src/rlc-common/metadata/build-package-file.d.ts.map +1 -1
  34. package/dist/src/rlc-common/metadata/build-package-file.js +0 -12
  35. package/dist/src/rlc-common/metadata/build-package-file.js.map +1 -1
  36. package/dist/src/rlc-common/metadata/build-readme-file.d.ts.map +1 -1
  37. package/dist/src/rlc-common/metadata/build-readme-file.js +4 -89
  38. package/dist/src/rlc-common/metadata/build-readme-file.js.map +1 -1
  39. package/dist/src/rlc-common/metadata/package-json/build-azure-monorepo-package.d.ts +0 -1
  40. package/dist/src/rlc-common/metadata/package-json/build-azure-monorepo-package.d.ts.map +1 -1
  41. package/dist/src/rlc-common/metadata/package-json/build-azure-monorepo-package.js +2 -2
  42. package/dist/src/rlc-common/metadata/package-json/build-azure-monorepo-package.js.map +1 -1
  43. package/dist/src/rlc-common/metadata/package-json/package-common.d.ts +0 -1
  44. package/dist/src/rlc-common/metadata/package-json/package-common.d.ts.map +1 -1
  45. package/dist/src/rlc-common/metadata/package-json/package-common.js.map +1 -1
  46. package/dist/src/rlc-common/test/build-snippets.d.ts.map +1 -1
  47. package/dist/src/rlc-common/test/build-snippets.js +0 -1
  48. package/dist/src/rlc-common/test/build-snippets.js.map +1 -1
  49. package/dist/src/rlc-common/test/template.d.ts +1 -1
  50. package/dist/src/rlc-common/test/template.d.ts.map +1 -1
  51. package/dist/src/rlc-common/test/template.js +0 -4
  52. package/dist/src/rlc-common/test/template.js.map +1 -1
  53. package/dist/src/transform/transform-schemas.js +1 -1
  54. package/dist/src/transform/transform-schemas.js.map +1 -1
  55. package/dist/src/transform/transform.d.ts.map +1 -1
  56. package/dist/src/transform/transform.js +5 -11
  57. package/dist/src/transform/transform.js.map +1 -1
  58. package/dist/src/transform/transfrom-rlc-options.d.ts +2 -2
  59. package/dist/src/transform/transfrom-rlc-options.d.ts.map +1 -1
  60. package/dist/src/transform/transfrom-rlc-options.js +19 -39
  61. package/dist/src/transform/transfrom-rlc-options.js.map +1 -1
  62. package/dist/src/utils/client-utils.d.ts +1 -1
  63. package/dist/src/utils/client-utils.d.ts.map +1 -1
  64. package/dist/src/utils/client-utils.js +4 -5
  65. package/dist/src/utils/client-utils.js.map +1 -1
  66. package/dist/src/utils/emit-util.d.ts +0 -1
  67. package/dist/src/utils/emit-util.d.ts.map +1 -1
  68. package/dist/src/utils/emit-util.js +0 -13
  69. package/dist/src/utils/emit-util.js.map +1 -1
  70. package/dist/src/utils/model-utils.d.ts +1 -1
  71. package/dist/src/utils/model-utils.d.ts.map +1 -1
  72. package/dist/src/utils/model-utils.js +4 -11
  73. package/dist/src/utils/model-utils.js.map +1 -1
  74. package/dist/tsconfig.tsbuildinfo +1 -1
  75. package/package.json +40 -44
  76. package/src/framework/hooks/sdk-types.ts +3 -2
  77. package/src/index.ts +27 -105
  78. package/src/lib.ts +1 -77
  79. package/src/modular/build-classical-client.ts +2 -2
  80. package/src/modular/emit-models.ts +20 -5
  81. package/src/modular/emit-samples.ts +119 -38
  82. package/src/modular/serialization/serialize-utils.ts +2 -2
  83. package/src/rlc-common/helpers/name-constructors.ts +1 -8
  84. package/src/rlc-common/index.ts +0 -16
  85. package/src/rlc-common/interfaces.ts +0 -11
  86. package/src/rlc-common/metadata/build-package-file.ts +0 -13
  87. package/src/rlc-common/metadata/build-readme-file.ts +4 -99
  88. package/src/rlc-common/metadata/package-json/build-azure-monorepo-package.ts +2 -3
  89. package/src/rlc-common/metadata/package-json/package-common.ts +0 -1
  90. package/src/rlc-common/test/build-snippets.ts +0 -1
  91. package/src/rlc-common/test/template.ts +0 -4
  92. package/src/transform/transform-schemas.ts +1 -1
  93. package/src/transform/transform.ts +4 -14
  94. package/src/transform/transfrom-rlc-options.ts +19 -63
  95. package/src/utils/client-utils.ts +4 -5
  96. package/src/utils/emit-util.ts +1 -14
  97. package/src/utils/model-utils.ts +4 -17
  98. package/dist/src/rlc-common/build-client-definitions.d.ts +0 -6
  99. package/dist/src/rlc-common/build-client-definitions.d.ts.map +0 -1
  100. package/dist/src/rlc-common/build-client-definitions.js +0 -157
  101. package/dist/src/rlc-common/build-client-definitions.js.map +0 -1
  102. package/dist/src/rlc-common/build-client.d.ts +0 -9
  103. package/dist/src/rlc-common/build-client.d.ts.map +0 -1
  104. package/dist/src/rlc-common/build-client.js +0 -375
  105. package/dist/src/rlc-common/build-client.js.map +0 -1
  106. package/dist/src/rlc-common/build-index-file.d.ts +0 -6
  107. package/dist/src/rlc-common/build-index-file.d.ts.map +0 -1
  108. package/dist/src/rlc-common/build-index-file.js +0 -180
  109. package/dist/src/rlc-common/build-index-file.js.map +0 -1
  110. package/dist/src/rlc-common/build-is-unexpected-helper.d.ts +0 -6
  111. package/dist/src/rlc-common/build-is-unexpected-helper.d.ts.map +0 -1
  112. package/dist/src/rlc-common/build-is-unexpected-helper.js +0 -219
  113. package/dist/src/rlc-common/build-is-unexpected-helper.js.map +0 -1
  114. package/dist/src/rlc-common/build-logger.d.ts +0 -6
  115. package/dist/src/rlc-common/build-logger.d.ts.map +0 -1
  116. package/dist/src/rlc-common/build-logger.js +0 -23
  117. package/dist/src/rlc-common/build-logger.js.map +0 -1
  118. package/dist/src/rlc-common/build-method-shortcuts.d.ts +0 -5
  119. package/dist/src/rlc-common/build-method-shortcuts.d.ts.map +0 -1
  120. package/dist/src/rlc-common/build-method-shortcuts.js +0 -54
  121. package/dist/src/rlc-common/build-method-shortcuts.js.map +0 -1
  122. package/dist/src/rlc-common/build-object-types.d.ts +0 -29
  123. package/dist/src/rlc-common/build-object-types.d.ts.map +0 -1
  124. package/dist/src/rlc-common/build-object-types.js +0 -410
  125. package/dist/src/rlc-common/build-object-types.js.map +0 -1
  126. package/dist/src/rlc-common/build-paginate-helper.d.ts +0 -6
  127. package/dist/src/rlc-common/build-paginate-helper.d.ts.map +0 -1
  128. package/dist/src/rlc-common/build-paginate-helper.js +0 -27
  129. package/dist/src/rlc-common/build-paginate-helper.js.map +0 -1
  130. package/dist/src/rlc-common/build-parameter-types.d.ts +0 -14
  131. package/dist/src/rlc-common/build-parameter-types.d.ts.map +0 -1
  132. package/dist/src/rlc-common/build-parameter-types.js +0 -338
  133. package/dist/src/rlc-common/build-parameter-types.js.map +0 -1
  134. package/dist/src/rlc-common/build-polling-helper.d.ts +0 -6
  135. package/dist/src/rlc-common/build-polling-helper.d.ts.map +0 -1
  136. package/dist/src/rlc-common/build-polling-helper.js +0 -59
  137. package/dist/src/rlc-common/build-polling-helper.js.map +0 -1
  138. package/dist/src/rlc-common/build-response-types.d.ts +0 -6
  139. package/dist/src/rlc-common/build-response-types.d.ts.map +0 -1
  140. package/dist/src/rlc-common/build-response-types.js +0 -140
  141. package/dist/src/rlc-common/build-response-types.js.map +0 -1
  142. package/dist/src/rlc-common/build-samples.d.ts +0 -3
  143. package/dist/src/rlc-common/build-samples.d.ts.map +0 -1
  144. package/dist/src/rlc-common/build-samples.js +0 -30
  145. package/dist/src/rlc-common/build-samples.js.map +0 -1
  146. package/dist/src/rlc-common/build-schema-type.d.ts +0 -20
  147. package/dist/src/rlc-common/build-schema-type.d.ts.map +0 -1
  148. package/dist/src/rlc-common/build-schema-type.js +0 -64
  149. package/dist/src/rlc-common/build-schema-type.js.map +0 -1
  150. package/dist/src/rlc-common/build-serialize-helper.d.ts +0 -6
  151. package/dist/src/rlc-common/build-serialize-helper.d.ts.map +0 -1
  152. package/dist/src/rlc-common/build-serialize-helper.js +0 -36
  153. package/dist/src/rlc-common/build-serialize-helper.js.map +0 -1
  154. package/dist/src/rlc-common/build-top-level-index-file.d.ts +0 -6
  155. package/dist/src/rlc-common/build-top-level-index-file.d.ts.map +0 -1
  156. package/dist/src/rlc-common/build-top-level-index-file.js +0 -44
  157. package/dist/src/rlc-common/build-top-level-index-file.js.map +0 -1
  158. package/dist/src/rlc-common/helpers/path-utils.d.ts +0 -2
  159. package/dist/src/rlc-common/helpers/path-utils.d.ts.map +0 -1
  160. package/dist/src/rlc-common/helpers/path-utils.js +0 -9
  161. package/dist/src/rlc-common/helpers/path-utils.js.map +0 -1
  162. package/dist/src/rlc-common/helpers/shortcut-methods.d.ts +0 -4
  163. package/dist/src/rlc-common/helpers/shortcut-methods.d.ts.map +0 -1
  164. package/dist/src/rlc-common/helpers/shortcut-methods.js +0 -49
  165. package/dist/src/rlc-common/helpers/shortcut-methods.js.map +0 -1
  166. package/dist/src/rlc-common/helpers/value-generation-util.d.ts +0 -12
  167. package/dist/src/rlc-common/helpers/value-generation-util.d.ts.map +0 -1
  168. package/dist/src/rlc-common/helpers/value-generation-util.js +0 -161
  169. package/dist/src/rlc-common/helpers/value-generation-util.js.map +0 -1
  170. package/dist/src/rlc-common/transform-sample-groups.d.ts +0 -9
  171. package/dist/src/rlc-common/transform-sample-groups.d.ts.map +0 -1
  172. package/dist/src/rlc-common/transform-sample-groups.js +0 -298
  173. package/dist/src/rlc-common/transform-sample-groups.js.map +0 -1
  174. package/src/rlc-common/build-client-definitions.ts +0 -226
  175. package/src/rlc-common/build-client.ts +0 -463
  176. package/src/rlc-common/build-index-file.ts +0 -220
  177. package/src/rlc-common/build-is-unexpected-helper.ts +0 -241
  178. package/src/rlc-common/build-logger.ts +0 -29
  179. package/src/rlc-common/build-method-shortcuts.ts +0 -71
  180. package/src/rlc-common/build-object-types.ts +0 -591
  181. package/src/rlc-common/build-paginate-helper.ts +0 -31
  182. package/src/rlc-common/build-parameter-types.ts +0 -460
  183. package/src/rlc-common/build-polling-helper.ts +0 -80
  184. package/src/rlc-common/build-response-types.ts +0 -170
  185. package/src/rlc-common/build-samples.ts +0 -32
  186. package/src/rlc-common/build-schema-type.ts +0 -79
  187. package/src/rlc-common/build-serialize-helper.ts +0 -49
  188. package/src/rlc-common/build-top-level-index-file.ts +0 -51
  189. package/src/rlc-common/helpers/path-utils.ts +0 -8
  190. package/src/rlc-common/helpers/shortcut-methods.ts +0 -58
  191. package/src/rlc-common/helpers/value-generation-util.ts +0 -234
  192. package/src/rlc-common/transform-sample-groups.ts +0 -383
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@azure-tools/typespec-ts",
3
- "version": "0.55.0-dev.8",
4
- "description": "An experimental TypeSpec emitter for TypeScript RLC",
3
+ "version": "0.55.0",
4
+ "description": "An experimental TypeSpec emitter for TypeScript",
5
5
  "main": "dist/src/index.js",
6
6
  "type": "module",
7
7
  "exports": {
@@ -18,15 +18,6 @@
18
18
  "license": "MIT",
19
19
  "devDependencies": {
20
20
  "@azure-rest/core-client": "^2.3.1",
21
- "@typespec/http-specs": "^0.1.0-alpha.38 || >=0.1.0-alpha.39-dev <0.1.0-alpha.39",
22
- "@typespec/spector": "^0.1.0-alpha.25 || >=0.1.0-alpha.26-dev <0.1.0-alpha.26",
23
- "@typespec/spec-api": "^0.1.0-alpha.14 || >=0.1.0-alpha.15-dev <0.1.0-alpha.15",
24
- "@typespec/tspd": "^0.75.0 || >=0.76.0-dev <0.76.0",
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.1 || >=0.70.0-dev <0.70.0",
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.1 || >=0.70.0-dev <0.70.0",
29
- "@azure-tools/typespec-client-generator-core": "^0.69.0 || >=0.70.0-dev <0.70.0",
30
21
  "@azure/abort-controller": "^2.1.2",
31
22
  "@azure/core-auth": "^1.6.0",
32
23
  "@azure/core-lro": "^3.1.0",
@@ -34,13 +25,7 @@
34
25
  "@azure/core-rest-pipeline": "^1.14.0",
35
26
  "@azure/core-util": "^1.4.0",
36
27
  "@azure/logger": "^1.0.4",
37
- "@typespec/compiler": "^1.13.0",
38
- "@typespec/http": "^1.13.0",
39
- "@typespec/openapi": "^1.13.0",
40
- "@typespec/rest": "^0.83.0 || >=0.84.0-dev <0.84.0",
41
- "@typespec/versioning": "^0.83.0 || >=0.84.0-dev <0.84.0",
42
- "@typespec/xml": "^0.83.0 || >=0.84.0-dev <0.84.0",
43
- "@typespec/ts-http-runtime": "0.3.5",
28
+ "@typespec/ts-http-runtime": "0.3.6",
44
29
  "cross-env": "^10.1.0",
45
30
  "mkdirp": "^3.0.1",
46
31
  "npm-run-all": "~4.1.5",
@@ -49,17 +34,31 @@
49
34
  "vite": "^8.0.8",
50
35
  "@vitest/coverage-v8": "^4.1.3",
51
36
  "@microsoft/api-extractor": "^7.58.1",
52
- "tsx": "^4.21.0",
53
- "yaml": "^2.8.3"
37
+ "yaml": "^2.8.3",
38
+ "@typespec/http-specs": "^0.1.0-alpha.38",
39
+ "@typespec/spector": "^0.1.0-alpha.25",
40
+ "@typespec/spec-api": "^0.1.0-alpha.14",
41
+ "@azure-tools/azure-http-specs": "^0.1.0-alpha.42",
42
+ "@azure-tools/typespec-autorest": "^0.69.1",
43
+ "@typespec/tspd": "^0.75.0",
44
+ "@azure-tools/typespec-azure-core": "^0.69.0",
45
+ "@azure-tools/typespec-azure-resource-manager": "^0.69.1",
46
+ "@azure-tools/typespec-client-generator-core": "^0.69.1",
47
+ "@typespec/compiler": "^1.13.0",
48
+ "@typespec/openapi": "^1.13.0",
49
+ "@typespec/rest": "^0.83.0",
50
+ "@typespec/versioning": "^0.83.0",
51
+ "@typespec/xml": "^0.83.0",
52
+ "@typespec/http": "^1.13.0"
54
53
  },
55
54
  "peerDependencies": {
56
- "@azure-tools/typespec-azure-core": "^0.69.0 || >=0.70.0-dev <0.70.0",
57
- "@azure-tools/typespec-client-generator-core": "^0.69.0 || >=0.70.0-dev <0.70.0",
58
- "@typespec/compiler": "^1.13.0",
55
+ "@azure-tools/typespec-azure-core": "^0.69.0",
59
56
  "@typespec/http": "^1.13.0",
60
- "@typespec/rest": "^0.83.0 || >=0.84.0-dev <0.84.0",
61
- "@typespec/versioning": "^0.83.0 || >=0.84.0-dev <0.84.0",
62
- "@typespec/xml": "^0.83.0 || >=0.84.0-dev <0.84.0"
57
+ "@typespec/compiler": "^1.13.0",
58
+ "@azure-tools/typespec-client-generator-core": "^0.69.1",
59
+ "@typespec/rest": "^0.83.0",
60
+ "@typespec/versioning": "^0.83.0",
61
+ "@typespec/xml": "^0.83.0"
63
62
  },
64
63
  "dependencies": {
65
64
  "fast-xml-parser": "^5.7.0",
@@ -90,32 +89,29 @@
90
89
  "clean": "rimraf ./dist ./typespec-output",
91
90
  "build": "tsc -p .",
92
91
  "test": "npm run test-next && npm run unit-test && npm run integration-test-ci",
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",
92
+ "test:azure": "npm run test-next && npm run copy:typespec && npm run integration-test-ci:azure-modular",
94
93
  "lint": "eslint . --ext .ts --max-warnings=0",
95
94
  "lint:fix": "eslint . --fix --ext .ts",
96
- "check:tree": "tsx ./test/commands/check-clean-tree.ts",
97
- "test:ts:e2e": "npm run copy:typespec && npm run integration-test-ci:azure-rlc && npm run integration-test-ci:azure-modular",
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",
100
- "integration-test-ci:azure-rlc": "npm-run-all --silent -p start-test-server:azure-rlc --race generate-and-run:azure-rlc",
95
+ "check:tree": "node ./test/commands/check-clean-tree.ts",
96
+ "test:ts:e2e": "npm run copy:typespec && npm run integration-test-ci:azure-modular",
97
+ "integration-test-ci": "npm-run-all copy:typespec integration-test-ci:azure-modular",
98
+ "integration-test-ci:sequential": "npm-run-all --serial copy:typespec integration-test-ci:azure-modular",
101
99
  "integration-test-ci:azure-modular": "npm-run-all --silent -p start-test-server:azure-modular --race generate-and-run:azure-modular",
102
100
  "start-test-server": "mkdirp -p coverage && npx tsp-spector serve ./node_modules/@typespec/http-specs/specs --coverageFile ./coverage/spector-coverage-typescript.json",
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",
104
101
  "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",
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",
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",
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",
108
- "generate-tsp-only": "npm run generate-tsp-only:azure-rlc && npm run generate-tsp-only:azure-modular",
109
- "generate-tsp-only:azure-rlc": "npx tsx ./test/commands/gen-spector.js --tag=azure-rlc",
110
- "generate-tsp-only:azure-modular": "npx tsx ./test/commands/gen-spector.js --tag=azure-modular",
102
+ "copy:typespec": "node ./test/commands/copy-typespec.ts",
103
+ "generate-and-run:azure-modular": "npm run generate-tsp-only:azure-modular:client && npm-run-all -p integration-test:alone:azure-modular generate-tsp-only:azure-modular:declarations && npm run stop-test-server -- -p 3002",
104
+ "generate-tsp-only": "npm run generate-tsp-only:azure-modular",
105
+ "generate-tsp-only:azure-modular": "node ./test/commands/gen-spector.js",
106
+ "generate-tsp-only:azure-modular:client": "node ./test/commands/gen-spector.js --phase=client",
107
+ "generate-tsp-only:azure-modular:declarations": "node ./test/commands/gen-spector.js --phase=declarations",
111
108
  "regen-test-baselines": "npm run generate-tsp-only",
112
- "integration-test:alone": "npm run integration-test:alone:azure-rlc && npm run integration-test:alone:azure-modular",
113
- "integration-test:alone:azure-rlc": "vitest run --project integration-azure-rlc",
109
+ "integration-test:alone": "npm run integration-test:alone:azure-modular",
114
110
  "integration-test:alone:azure-modular": "vitest run --project integration-azure-modular",
115
111
  "stop-test-server": "npx tsp-spector server stop",
116
- "unit-test": "npm-run-all --parallel unit-test:rlc unit-test:modular",
117
- "unit-test:rlc": "vitest run --project unit-rlc",
118
- "unit-test:modular": "cross-env NODE_OPTIONS=--max-old-space-size=8192 vitest run --project unit-modular",
112
+ "unit-test": "npm run unit-test:modular",
113
+ "unit-test:modular": "cross-env NODE_OPTIONS=--max-old-space-size=1024 vitest run --project unit-modular",
114
+ "gen:scenario-suites": "node ./test/commands/gen-scenario-suites.ts",
119
115
  "regen-docs": "npm run build && tspd doc . --enable-experimental --output-dir ../../website/src/content/docs/docs/emitters/clients/typespec-ts/reference --skip-js"
120
116
  }
121
117
  }
@@ -23,10 +23,11 @@ export const flattenPropertyModelMap: Map<SdkModelPropertyType, SdkModelType> =
23
23
  SdkModelType
24
24
  >();
25
25
  /**
26
- * Set of paged result models that are also used in non-paging operations.
26
+ * Set of paged result models that should keep their public name (no "_" prefix).
27
+ * This includes models used as non-paging method responses or as model properties.
27
28
  * Precomputed during visitPackageTypes for O(1) lookups in normalizeModelName.
28
29
  */
29
- export const pagedModelsUsedInNonPagingOps = new Set<SdkType>();
30
+ export const pagedModelsKeptPublic = new Set<SdkType>();
30
31
 
31
32
  export interface SdkTypeContext {
32
33
  operations: Map<Type, SdkServiceMethod<SdkHttpOperation>>;
package/src/index.ts CHANGED
@@ -36,28 +36,16 @@ import {
36
36
  RLCOptions,
37
37
  buildApiExtractorConfig,
38
38
  buildChangelogFile,
39
- buildClient,
40
- buildClientDefinitions,
41
39
  buildEsLintConfig,
42
- buildIndexFile,
43
- buildIsUnexpectedHelper,
44
40
  buildLicenseFile,
45
- buildLogger,
46
41
  buildPackageFile,
47
- buildParameterTypes,
48
- buildPollingHelper,
49
- buildPaginateHelper as buildRLCPaginateHelper,
50
42
  buildReadmeFile,
51
43
  buildRecordedClientFile,
52
- buildResponseTypes,
53
44
  buildSampleEnvFile,
54
45
  buildSampleTest,
55
- buildSamples,
56
- buildSerializeHelper,
57
46
  buildSnippets,
58
47
  buildTestBrowserTsConfig,
59
48
  buildTestNodeTsConfig,
60
- buildTopLevelIndex,
61
49
  buildTsConfig,
62
50
  buildTsLintConfig,
63
51
  buildTsSampleConfig,
@@ -74,7 +62,7 @@ import {
74
62
  updatePackageFile,
75
63
  updateReadmeFile,
76
64
  } from "./rlc-common/index.js";
77
- import { emitContentByBuilder, emitModels } from "./utils/emit-util.js";
65
+ import { emitContentByBuilder } from "./utils/emit-util.js";
78
66
  import { clearDirectory, emptyDir, pathExists } from "./utils/file-system-utils.js";
79
67
  import { GenerationDirDetail, SdkContext } from "./utils/interfaces.js";
80
68
 
@@ -201,11 +189,7 @@ export async function $onEmit(context: EmitContext) {
201
189
  await clearSamplesDevFolder();
202
190
 
203
191
  // 4. Generate sources
204
- if (emitterOptions["is-modular-library"]) {
205
- await generateModularSources();
206
- } else {
207
- await generateRLCSources();
208
- }
192
+ await generateModularSources();
209
193
 
210
194
  // 5. Generate metadata and test files
211
195
  function getTypespecTsVersion(context: EmitContext): string | undefined {
@@ -222,7 +206,6 @@ export async function $onEmit(context: EmitContext) {
222
206
  dpgContext.generationPathDetail = generationPathDetail;
223
207
  dpgContext.allServiceNamespaces = listAllServiceNamespaces(dpgContext);
224
208
  const options: RLCOptions = transformRLCOptions(emitterOptions, dpgContext);
225
- emitterOptions["is-modular-library"] = options.isModularLibrary;
226
209
  emitterOptions["generate-sample"] = options.generateSample;
227
210
  // clear output folder if needed
228
211
  if (options.clearOutputFolder) {
@@ -290,57 +273,6 @@ export async function $onEmit(context: EmitContext) {
290
273
  }
291
274
  }
292
275
 
293
- async function generateRLCSources() {
294
- for (const rlcModels of rlcCodeModels) {
295
- await emitModels(rlcModels, program);
296
- await emitContentByBuilder(program, buildClientDefinitions, rlcModels);
297
- await emitContentByBuilder(program, buildResponseTypes, rlcModels);
298
- await emitContentByBuilder(program, buildClient, rlcModels);
299
- await emitContentByBuilder(program, buildParameterTypes, rlcModels);
300
- await emitContentByBuilder(program, buildIsUnexpectedHelper, rlcModels);
301
- await emitContentByBuilder(program, buildIndexFile, rlcModels);
302
- await emitContentByBuilder(program, buildLogger, rlcModels);
303
- await emitContentByBuilder(program, buildTopLevelIndex, rlcModels);
304
- await emitContentByBuilder(program, buildRLCPaginateHelper, rlcModels);
305
- await emitContentByBuilder(program, buildPollingHelper, rlcModels);
306
- await emitContentByBuilder(program, buildSerializeHelper, rlcModels);
307
- await emitContentByBuilder(
308
- program,
309
- buildSamples,
310
- rlcModels,
311
- dpgContext.generationPathDetail?.metadataDir,
312
- );
313
- }
314
- // The binder is only resolved in the modular path, so static helper files
315
- // loaded into the outputProject are never written to disk in the RLC path.
316
- // The RLC builders reference the platform-types helper (NodeReadableStream),
317
- // so emit those files here.
318
- await emitRLCStaticHelpers();
319
- }
320
-
321
- async function emitRLCStaticHelpers() {
322
- if (program.compilerOptions.noEmit || program.hasError() || !rlcCodeModels[0]) {
323
- return;
324
- }
325
- const project = useContext("outputProject");
326
- for (const helperFile of project.getSourceFiles()) {
327
- const filePath = helperFile.getFilePath();
328
- // RLC builders (buildParameterTypes / buildSchemaType) only reference
329
- // platform-types (and its browser/react-native variants); emit those
330
- // files directly under src/ (strip the static-helpers/ segment) to match
331
- // the RLC design where all generated output lives in src/.
332
- if (!getBaseFileName(filePath).startsWith("platform-types")) {
333
- continue;
334
- }
335
- const outputPath = filePath.replace(/\/static-helpers\//g, "/");
336
- await emitContentByBuilder(
337
- program,
338
- () => ({ content: helperFile.getFullText(), path: outputPath }),
339
- rlcCodeModels[0],
340
- );
341
- }
342
- }
343
-
344
276
  async function generateModularSources() {
345
277
  const modularSourcesRoot = dpgContext.generationPathDetail?.modularSourcesDir ?? "src";
346
278
  const project = useContext("outputProject");
@@ -441,9 +373,7 @@ export async function $onEmit(context: EmitContext) {
441
373
  if (emitterVersion !== undefined) {
442
374
  content.emitterVersion = emitterVersion;
443
375
  }
444
- if (dpgContext.rlcOptions?.isModularLibrary) {
445
- content.crossLanguageDefinitions = generateCrossLanguageDefinitionFile(dpgContext);
446
- }
376
+ content.crossLanguageDefinitions = generateCrossLanguageDefinitionFile(dpgContext);
447
377
  return {
448
378
  path: "metadata.json",
449
379
  content: JSON.stringify(content, null, 2),
@@ -495,10 +425,8 @@ export async function $onEmit(context: EmitContext) {
495
425
  }
496
426
 
497
427
  //TODO Need consider multi-client cases
498
- if (option.isModularLibrary) {
499
- for (const subClient of dpgContext.sdkPackage.clients) {
500
- rlcClient.libraryName = subClient.name;
501
- }
428
+ for (const subClient of dpgContext.sdkPackage.clients) {
429
+ rlcClient.libraryName = subClient.name;
502
430
  }
503
431
 
504
432
  if (shouldGenerateMetadata) {
@@ -524,11 +452,10 @@ export async function $onEmit(context: EmitContext) {
524
452
  ) {
525
453
  await emitTests(dpgContext, host);
526
454
  }
527
- let modularPackageInfo = {};
528
- if (option.isModularLibrary) {
529
- modularPackageInfo = {
530
- exports: getModuleExports(context, modularEmitterOptions),
531
- };
455
+ let modularPackageInfo: Record<string, any> = {
456
+ exports: getModuleExports(context, modularEmitterOptions),
457
+ };
458
+ {
532
459
  // Build dependencies
533
460
  const dependencies: Record<string, string> = {};
534
461
  dependencies["@azure/core-util"] = "^1.9.2";
@@ -573,35 +500,30 @@ export async function $onEmit(context: EmitContext) {
573
500
  dpgContext.generationPathDetail?.metadataDir,
574
501
  );
575
502
 
576
- if (option.isModularLibrary) {
577
- for (const file of project.getSourceFiles()) {
578
- await emitContentByBuilder(
579
- program,
580
- () => ({ content: file.getFullText(), path: file.getFilePath() }),
581
- modularEmitterOptions as any,
582
- );
583
- }
503
+ for (const file of project.getSourceFiles()) {
504
+ await emitContentByBuilder(
505
+ program,
506
+ () => ({ content: file.getFullText(), path: file.getFilePath() }),
507
+ modularEmitterOptions as any,
508
+ );
584
509
  }
585
510
  } else if (hasPackageFile && !hasManualConvenienceLayer) {
586
511
  const updateBuilders = [];
587
- let modularPackageInfo = {};
588
512
 
589
513
  // update existing package.json file with correct dependencies
590
- if (option.isModularLibrary) {
591
- // Additional format-specific dependencies to merge when migrating
592
- // (e.g. fast-xml-parser when XML serialization is used)
593
- const additionalDependencies: Record<string, string> = {};
594
- if (packageUsesXmlSerialization(dpgContext.sdkPackage)) {
595
- additionalDependencies["fast-xml-parser"] = "^4.5.0";
596
- }
597
- modularPackageInfo = {
598
- exports: getModuleExports(context, modularEmitterOptions),
599
- clientContextPaths: getRelativeContextPaths(context, modularEmitterOptions),
600
- ...(Object.keys(additionalDependencies).length > 0 && {
601
- dependencies: additionalDependencies,
602
- }),
603
- };
514
+ // Additional format-specific dependencies to merge when migrating
515
+ // (e.g. fast-xml-parser when XML serialization is used)
516
+ const additionalDependencies: Record<string, string> = {};
517
+ if (packageUsesXmlSerialization(dpgContext.sdkPackage)) {
518
+ additionalDependencies["fast-xml-parser"] = "^4.5.0";
604
519
  }
520
+ const modularPackageInfo = {
521
+ exports: getModuleExports(context, modularEmitterOptions),
522
+ clientContextPaths: getRelativeContextPaths(context, modularEmitterOptions),
523
+ ...(Object.keys(additionalDependencies).length > 0 && {
524
+ dependencies: additionalDependencies,
525
+ }),
526
+ };
605
527
 
606
528
  // Always update package.json (adds #platform/* imports) and, for modular
607
529
  // packages, exports, clientContextPaths and LRO deps.
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, ServiceInfo } from "./rlc-common/index.js";
6
+ import { PackageDetails } from "./rlc-common/index.js";
7
7
 
8
8
  export interface EmitterOptions {
9
9
  /**
@@ -13,9 +13,6 @@ export interface EmitterOptions {
13
13
  * currently affected by this option.
14
14
  */
15
15
  "include-headers-in-response"?: boolean;
16
- "include-shortcuts"?: boolean;
17
- "multi-client"?: boolean;
18
- batch?: any[];
19
16
  "package-details"?: PackageDetails;
20
17
  "add-credentials"?: boolean;
21
18
  /** Three possible values:
@@ -42,14 +39,8 @@ export interface EmitterOptions {
42
39
  */
43
40
  "generate-test"?: boolean;
44
41
  "generate-sample"?: boolean;
45
- "azure-output-directory"?: string;
46
42
  "is-typespec-test"?: boolean;
47
- title?: string;
48
- "dependency-info"?: DependencyInfo;
49
- "product-doc-link"?: string;
50
- "service-info"?: ServiceInfo;
51
43
  "azure-arm"?: boolean;
52
- "is-modular-library"?: boolean;
53
44
  "enable-operation-group"?: boolean;
54
45
  "enable-model-namespace"?: boolean;
55
46
  "hierarchy-client"?: boolean;
@@ -61,7 +52,6 @@ export interface EmitterOptions {
61
52
  "compatibility-query-multi-format"?: boolean;
62
53
  "typespec-title-map"?: Record<string, string>;
63
54
  "ignore-enum-member-name-normalize"?: boolean;
64
- "default-value-object"?: boolean;
65
55
  //TODO should remove this after finish the release tool test
66
56
  "should-use-pnpm-dep"?: boolean;
67
57
  "ignore-nullable-on-optional"?: boolean;
@@ -102,24 +92,6 @@ export const RLCOptionsSchema: JSONSchemaType<EmitterOptions> = {
102
92
  description:
103
93
  "This option is used to indicate whether to include response headers in the generated response type. When set to true, the generated response type will include response headers as properties.",
104
94
  },
105
- "include-shortcuts": {
106
- type: "boolean",
107
- nullable: true,
108
- description: "Deprecated option for RLC legacy generation.",
109
- },
110
- "multi-client": {
111
- type: "boolean",
112
- nullable: true,
113
- description: "Deprecated option for RLC legacy generation.",
114
- },
115
- batch: {
116
- type: "array",
117
- nullable: true,
118
- items: {
119
- type: "string",
120
- },
121
- description: "Deprecated option for RLC legacy generation.",
122
- },
123
95
  "package-details": {
124
96
  type: "object",
125
97
  additionalProperties: true,
@@ -199,59 +171,16 @@ export const RLCOptionsSchema: JSONSchemaType<EmitterOptions> = {
199
171
  description:
200
172
  "Whether to generate sample files, for basic samples of your generated sdks. Defaults to `undefined`. Management packages' default to `true`.",
201
173
  },
202
- "azure-output-directory": {
203
- type: "string",
204
- nullable: true,
205
- description: "Deprecated option for RLC legacy generation",
206
- },
207
174
  "is-typespec-test": {
208
175
  type: "boolean",
209
176
  nullable: true,
210
177
  description: "Internal option for test",
211
178
  },
212
- title: {
213
- type: "string",
214
- nullable: true,
215
- description: "Deprecated option for RLC legacy generation.",
216
- },
217
- "dependency-info": {
218
- type: "object",
219
- additionalProperties: true,
220
- properties: {
221
- link: { type: "string", nullable: false },
222
- description: { type: "string", nullable: false },
223
- },
224
- required: [],
225
- nullable: true,
226
- description: "Deprecated option for RLC legacy generation.",
227
- },
228
- "product-doc-link": {
229
- type: "string",
230
- nullable: true,
231
- description: "Deprecated option for RLC legacy generation.",
232
- },
233
- "service-info": {
234
- type: "object",
235
- additionalProperties: true,
236
- properties: {
237
- title: { type: "string", nullable: true },
238
- description: { type: "string", nullable: true },
239
- },
240
- nullable: true,
241
- description: "Deprecated option for RLC legacy generation.",
242
- },
243
179
  "azure-arm": {
244
180
  type: "boolean",
245
181
  nullable: true,
246
182
  description: "Whether the package is an arm package.",
247
183
  },
248
- "is-modular-library": {
249
- type: "boolean",
250
- nullable: true,
251
- default: false,
252
- description:
253
- "Whether to generate a Modular library. Defaults to `false`. Arm packages default to `true`.",
254
- },
255
184
  "enable-operation-group": {
256
185
  type: "boolean",
257
186
  nullable: true,
@@ -311,11 +240,6 @@ export const RLCOptionsSchema: JSONSchemaType<EmitterOptions> = {
311
240
  description:
312
241
  "Whether to generate the backward-compatible code for query parameter serialization for array types in RLC. Defaults to `false`",
313
242
  },
314
- "default-value-object": {
315
- type: "boolean",
316
- nullable: true,
317
- description: "Deprecated option for RLC legacy generation.",
318
- },
319
243
  "typespec-title-map": {
320
244
  type: "object",
321
245
  additionalProperties: {
@@ -290,8 +290,8 @@ function buildClientOperationGroups(
290
290
  } else {
291
291
  // The `rawGroupName` is used to any places where we need normalized name twice so we need to keep the raw as PascalCase.
292
292
  const rawGroupName = normalizeName(prefixes[0] ?? "", NameType.Interface);
293
- const operationName = `_get${normalizeName(rawGroupName, NameType.OperationGroup)}Operations`;
294
- const propertyType = `${normalizeName(rawGroupName, NameType.OperationGroup)}Operations`;
293
+ const operationName = `_get${rawGroupName}Operations`;
294
+ const propertyType = `${rawGroupName}Operations`;
295
295
  // The `groupName` is used to any places where we don't need normalized name again
296
296
  const groupName = normalizeName(rawGroupName, NameType.Property);
297
297
  const existProperty = clientClass.getProperties().filter((p) => {
@@ -44,7 +44,7 @@ import {
44
44
  emitQueue,
45
45
  flattenPropertyModelMap,
46
46
  getAllOperationsFromClient,
47
- pagedModelsUsedInNonPagingOps,
47
+ pagedModelsKeptPublic,
48
48
  } from "../framework/hooks/sdk-types.js";
49
49
  import { refkey } from "../framework/refkey.js";
50
50
  import { reportDiagnostic } from "../lib.js";
@@ -841,8 +841,7 @@ export function normalizeModelName(
841
841
  }
842
842
  const namespacePrefix = context.rlcOptions?.enableModelNamespace ? segments.join("") : "";
843
843
  const internalModelPrefix =
844
- (isPagedResultModel(context, type) && !pagedModelsUsedInNonPagingOps.has(type)) ||
845
- type.isGeneratedName
844
+ (isPagedResultModel(context, type) && !pagedModelsKeptPublic.has(type)) || type.isGeneratedName
846
845
  ? "_"
847
846
  : "";
848
847
  return `${internalModelPrefix}${normalizeName(namespacePrefix + type.name, nameType, true)}${unionSuffix}`;
@@ -932,7 +931,7 @@ export function visitPackageTypes(context: SdkContext) {
932
931
  const { sdkPackage } = context;
933
932
  emitQueue.clear();
934
933
  flattenPropertyModelMap.clear();
935
- pagedModelsUsedInNonPagingOps.clear();
934
+ pagedModelsKeptPublic.clear();
936
935
  // Add all models in the package to the emit queue
937
936
  for (const model of sdkPackage.models) {
938
937
  visitType(context, model);
@@ -1015,7 +1014,19 @@ function trackPagedModelInNonPagingMethod(
1015
1014
  if (method.kind !== "basic" && method.kind !== "lro") return;
1016
1015
  const respType = method.response.type;
1017
1016
  if (respType && isPagedResultModel(context, respType)) {
1018
- pagedModelsUsedInNonPagingOps.add(respType);
1017
+ pagedModelsKeptPublic.add(respType);
1018
+ }
1019
+ }
1020
+
1021
+ /**
1022
+ * If a paged result model is used as a model property type, mark it so that
1023
+ * normalizeModelName keeps it public (no "_" prefix).
1024
+ */
1025
+ function trackPagedModelUsedAsProperty(context: SdkContext, type: SdkType): void {
1026
+ // Unwrap array types to check the element type
1027
+ const resolved = type.kind === "array" ? type.valueType : type;
1028
+ if (resolved && isPagedResultModel(context, resolved)) {
1029
+ pagedModelsKeptPublic.add(resolved);
1019
1030
  }
1020
1031
  }
1021
1032
 
@@ -1044,6 +1055,10 @@ function visitType(context: SdkContext, type: SdkType | undefined) {
1044
1055
  if (property.flatten && property.type.kind === "model") {
1045
1056
  flattenPropertyModelMap.set(property, type);
1046
1057
  }
1058
+ // If a paged result model is used as a model property (not as a paging
1059
+ // operation response), it must stay public (no "_" prefix) because users
1060
+ // interact with it directly through the property.
1061
+ trackPagedModelUsedAsProperty(context, property.type);
1047
1062
  }
1048
1063
  if (type.discriminatedSubtypes) {
1049
1064
  for (const subType of Object.values(type.discriminatedSubtypes)) {