@typespec/http-client-js 0.16.2-dev.1 → 0.16.2

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 (225) hide show
  1. package/dist/tsconfig.tsbuildinfo +1 -1
  2. package/package.json +24 -20
  3. package/.github/copilot-instructions.md +0 -180
  4. package/.testignore +0 -19
  5. package/.turbo/turbo-build.log +0 -3
  6. package/CHANGELOG.md +0 -159
  7. package/eng/scripts/calculate-coverage.ts +0 -33
  8. package/eng/scripts/emit-e2e.ts +0 -317
  9. package/eng/scripts/run-e2e-tests.ts +0 -166
  10. package/eng/scripts/tspconfig.yaml +0 -6
  11. package/eng/scripts/upload-spector-results.ts +0 -139
  12. package/src/components/client-context/client-context-declaration.tsx +0 -26
  13. package/src/components/client-context/client-context-factory.tsx +0 -218
  14. package/src/components/client-context/client-context-options.tsx +0 -36
  15. package/src/components/client-context/client-context.tsx +0 -23
  16. package/src/components/client-context/parametrized-endpoint.tsx +0 -51
  17. package/src/components/client-directory.tsx +0 -51
  18. package/src/components/client-operation.tsx +0 -102
  19. package/src/components/client.tsx +0 -177
  20. package/src/components/encoding-provider.tsx +0 -17
  21. package/src/components/external-packages/ts-http-runtime.ts +0 -28
  22. package/src/components/external-packages/uri-template.ts +0 -11
  23. package/src/components/http-request-options.tsx +0 -88
  24. package/src/components/http-request-parameters-expression.tsx +0 -191
  25. package/src/components/http-request.tsx +0 -80
  26. package/src/components/http-response.tsx +0 -74
  27. package/src/components/index.ts +0 -12
  28. package/src/components/models.tsx +0 -26
  29. package/src/components/operation-handlers/index.tsx +0 -2
  30. package/src/components/operation-handlers/operation-pipeline.tsx +0 -33
  31. package/src/components/operation-handlers/paging/page-item.tsx +0 -14
  32. package/src/components/operation-handlers/paging/page-response.tsx +0 -57
  33. package/src/components/operation-handlers/paging/page-settings.tsx +0 -53
  34. package/src/components/operation-handlers/paging/paginated-operation-handler.tsx +0 -200
  35. package/src/components/operation-handlers/paging/request-send.tsx +0 -85
  36. package/src/components/operation-handlers/paging/response-deserialize.tsx +0 -60
  37. package/src/components/operation-handlers/paging/util.ts +0 -70
  38. package/src/components/operation-handlers/types.tsx +0 -18
  39. package/src/components/operation-options.tsx +0 -42
  40. package/src/components/operation-parameters.tsx +0 -44
  41. package/src/components/output.tsx +0 -32
  42. package/src/components/serializers.tsx +0 -74
  43. package/src/components/static-helpers/bytes-encoding.tsx +0 -61
  44. package/src/components/static-helpers/interfaces.tsx +0 -31
  45. package/src/components/static-helpers/multipart-helpers.tsx +0 -80
  46. package/src/components/static-helpers/paging-helper.tsx +0 -202
  47. package/src/components/static-helpers/rest-error.tsx +0 -102
  48. package/src/components/testing/client-options.tsx +0 -30
  49. package/src/components/transforms/content-type-encoding-provider.tsx +0 -26
  50. package/src/components/transforms/data-transform.tsx +0 -40
  51. package/src/components/transforms/json/json-array-transform.tsx +0 -87
  52. package/src/components/transforms/json/json-model-additional-properties-transform.tsx +0 -54
  53. package/src/components/transforms/json/json-model-base-transform.tsx +0 -24
  54. package/src/components/transforms/json/json-model-property-transform.tsx +0 -53
  55. package/src/components/transforms/json/json-model-transform.tsx +0 -115
  56. package/src/components/transforms/json/json-record-transform.tsx +0 -88
  57. package/src/components/transforms/json/json-transform-discriminator.tsx +0 -111
  58. package/src/components/transforms/json/json-transform.tsx +0 -120
  59. package/src/components/transforms/json/union-transform.tsx +0 -87
  60. package/src/components/transforms/json/utils/transport-namer.ts +0 -12
  61. package/src/components/transforms/multipart/array-part-transform.tsx +0 -44
  62. package/src/components/transforms/multipart/file-part-transform.tsx +0 -45
  63. package/src/components/transforms/multipart/multipart-transform.tsx +0 -30
  64. package/src/components/transforms/multipart/part-transform.tsx +0 -22
  65. package/src/components/transforms/multipart/simple-part-transform.tsx +0 -42
  66. package/src/components/transforms/operation-transform-declaration.tsx +0 -83
  67. package/src/components/transforms/operation-transform-expression.tsx +0 -62
  68. package/src/components/transforms/scalar-transform.tsx +0 -301
  69. package/src/components/transforms/transform-name-policy.ts +0 -134
  70. package/src/components/utils/unpack-model-property.ts +0 -44
  71. package/src/components/utils/url-template.tsx +0 -25
  72. package/src/context/encoding/encoding-context.tsx +0 -28
  73. package/src/context/encoding/types.ts +0 -6
  74. package/src/emitter.tsx +0 -85
  75. package/src/index.ts +0 -5
  76. package/src/lib.ts +0 -120
  77. package/src/testing/index.ts +0 -11
  78. package/src/utils/client-discovery.ts +0 -28
  79. package/src/utils/multipart.ts +0 -29
  80. package/src/utils/operations.ts +0 -112
  81. package/src/utils/parameters.tsx +0 -155
  82. package/test/e2e/assets/image.jpg +0 -0
  83. package/test/e2e/assets/image.png +0 -0
  84. package/test/e2e/http/authentication/api-key/main.test.ts +0 -38
  85. package/test/e2e/http/authentication/oauth2/main.test.ts +0 -31
  86. package/test/e2e/http/authentication/union/main.test.ts +0 -26
  87. package/test/e2e/http/encode/bytes/main.test.ts +0 -191
  88. package/test/e2e/http/encode/datetime/main.test.ts +0 -176
  89. package/test/e2e/http/encode/duration/main.test.ts +0 -126
  90. package/test/e2e/http/encode/numeric/main.test.ts +0 -26
  91. package/test/e2e/http/parameters/basic/main.test.ts +0 -35
  92. package/test/e2e/http/parameters/body-optionality/main.test.ts +0 -43
  93. package/test/e2e/http/parameters/collection-format/main.test.ts +0 -40
  94. package/test/e2e/http/parameters/spread/main.test.ts +0 -56
  95. package/test/e2e/http/payload/content-negotiation/main.test.ts +0 -40
  96. package/test/e2e/http/payload/json-merge-patch/main.test.ts +0 -122
  97. package/test/e2e/http/payload/media-type/main.test.ts +0 -28
  98. package/test/e2e/http/payload/multipart/main.test.ts +0 -200
  99. package/test/e2e/http/payload/pageable/main.test.ts +0 -78
  100. package/test/e2e/http/payload/xml/main.test.ts +0 -287
  101. package/test/e2e/http/routes/main.test.ts +0 -284
  102. package/test/e2e/http/serialization/encoded-name/json/main.test.ts +0 -20
  103. package/test/e2e/http/server/endpoint/not-defined/main.test.ts +0 -11
  104. package/test/e2e/http/server/path/multiple/main.test.ts +0 -22
  105. package/test/e2e/http/server/path/single/main.test.ts +0 -11
  106. package/test/e2e/http/server/versions/not-versioned/main.test.ts +0 -22
  107. package/test/e2e/http/server/versions/versioned/main.test.ts +0 -28
  108. package/test/e2e/http/special-headers/conditional-request/main.test.ts +0 -35
  109. package/test/e2e/http/special-headers/repeatability/main.test.ts +0 -18
  110. package/test/e2e/http/special-words/main.test.ts +0 -434
  111. package/test/e2e/http/type/array/array.test.ts +0 -256
  112. package/test/e2e/http/type/dictionary/main.test.ts +0 -229
  113. package/test/e2e/http/type/enum/extensible/main.test.ts +0 -34
  114. package/test/e2e/http/type/enum/fixed/main.test.ts +0 -29
  115. package/test/e2e/http/type/model/empty/main.test.ts +0 -21
  116. package/test/e2e/http/type/model/inheritance/enum-discriminator/main.test.ts +0 -51
  117. package/test/e2e/http/type/model/inheritance/nested-discriminator/main.test.ts +0 -168
  118. package/test/e2e/http/type/model/inheritance/not-discriminated/main.test.ts +0 -42
  119. package/test/e2e/http/type/model/inheritance/recursive/main.test.ts +0 -46
  120. package/test/e2e/http/type/model/inheritance/single-discriminator/main.test.ts +0 -99
  121. package/test/e2e/http/type/model/visibility/main.test.ts +0 -64
  122. package/test/e2e/http/type/property/additional-properties/main.test.ts +0 -185
  123. package/test/e2e/http/type/property/additional-properties/spreads.test.ts +0 -448
  124. package/test/e2e/http/type/property/nullable/main.test.ts +0 -275
  125. package/test/e2e/http/type/property/optionality/main.test.ts +0 -256
  126. package/test/e2e/http/type/property/value-types/main.test.ts +0 -193
  127. package/test/e2e/http/type/scalar/main.test.ts +0 -133
  128. package/test/e2e/http/type/scalar/scalar.test.ts +0 -95
  129. package/test/e2e/http/type/union/main.test.ts +0 -207
  130. package/test/e2e/http/versioning/added/main.test.ts +0 -60
  131. package/test/e2e/http/versioning/madeOptional/main.test.ts +0 -34
  132. package/test/e2e/http/versioning/removed/main.test.ts +0 -75
  133. package/test/e2e/http/versioning/renamedFrom/main.test.ts +0 -52
  134. package/test/e2e/http/versioning/returnTypeChangedFrom/main.test.ts +0 -22
  135. package/test/e2e/http/versioning/typeChangedFrom/main.test.ts +0 -31
  136. package/test/scenarios/additional-properties/extends.md +0 -67
  137. package/test/scenarios/additional-properties/is.md +0 -42
  138. package/test/scenarios/additional-properties/spread.md +0 -68
  139. package/test/scenarios/auth/basic_auth.md +0 -68
  140. package/test/scenarios/auth/bearer.md +0 -68
  141. package/test/scenarios/auth/client_parameters.md +0 -78
  142. package/test/scenarios/auth/client_structure.md +0 -36
  143. package/test/scenarios/auth/key_credential.md +0 -69
  144. package/test/scenarios/auth/oauth2.md +0 -90
  145. package/test/scenarios/auth/sub_client_override.md +0 -114
  146. package/test/scenarios/client/client_context.md +0 -34
  147. package/test/scenarios/client/dotted_namespace.md +0 -27
  148. package/test/scenarios/client/global_namespace.md +0 -69
  149. package/test/scenarios/client/multiple_top_level_clients.md +0 -72
  150. package/test/scenarios/client/nested_client.md +0 -102
  151. package/test/scenarios/client/wrapping_namespace.md +0 -41
  152. package/test/scenarios/encoding/bytes_body.md +0 -44
  153. package/test/scenarios/encoding/bytes_json_property.md +0 -55
  154. package/test/scenarios/encoding/bytes_nullable.md +0 -139
  155. package/test/scenarios/encoding/header_bytes.md +0 -130
  156. package/test/scenarios/encoding/header_date.md +0 -216
  157. package/test/scenarios/encoding/model_with_bytes_property.md +0 -45
  158. package/test/scenarios/encoding/query_bytes.md +0 -42
  159. package/test/scenarios/encoding/query_date.md +0 -216
  160. package/test/scenarios/http-operations/basic-request.md +0 -144
  161. package/test/scenarios/http-operations/basic-response.md +0 -219
  162. package/test/scenarios/http-operations/basic.md +0 -128
  163. package/test/scenarios/http-operations/constant-header.md +0 -33
  164. package/test/scenarios/http-operations/create-operation.md +0 -58
  165. package/test/scenarios/http-operations/on_response.md +0 -52
  166. package/test/scenarios/http-operations/optional-request-body.md +0 -50
  167. package/test/scenarios/http-operations/paging.md +0 -242
  168. package/test/scenarios/http-operations/path-parameter-in-model.md +0 -53
  169. package/test/scenarios/http-operations/path-parameter.md +0 -48
  170. package/test/scenarios/http-operations/query-parameter.md +0 -41
  171. package/test/scenarios/http-operations/scalar-payload.md +0 -57
  172. package/test/scenarios/http-operations/with-parameters.md +0 -78
  173. package/test/scenarios/models/array-properties.md +0 -47
  174. package/test/scenarios/models/basic.md +0 -118
  175. package/test/scenarios/models/dictionary-properties.md +0 -44
  176. package/test/scenarios/models/inheritance_2_discriminators.md +0 -346
  177. package/test/scenarios/models/inheritance_discriminator.md +0 -88
  178. package/test/scenarios/models/inline-models.md +0 -29
  179. package/test/scenarios/models/model_additional_properties.md +0 -75
  180. package/test/scenarios/models/model_extends.md +0 -97
  181. package/test/scenarios/models/model_spread.md +0 -63
  182. package/test/scenarios/models/nested_property.md +0 -41
  183. package/test/scenarios/models/property_references_property.md +0 -150
  184. package/test/scenarios/multipart/anonymous_part.md +0 -53
  185. package/test/scenarios/multipart/file.md +0 -154
  186. package/test/scenarios/multipart/file_content_type.md +0 -92
  187. package/test/scenarios/multipart/non-string-float.md +0 -55
  188. package/test/scenarios/multipart/simple_part.md +0 -65
  189. package/test/scenarios/operation-parameters/body_root_anonymous.md +0 -87
  190. package/test/scenarios/operation-parameters/constant_as_optional.md +0 -54
  191. package/test/scenarios/operation-parameters/default_value_as_optional.md +0 -54
  192. package/test/scenarios/operation-parameters/no_content_type.md +0 -62
  193. package/test/scenarios/operation-parameters/no_parameters.md +0 -50
  194. package/test/scenarios/operation-parameters/only_optional.md +0 -62
  195. package/test/scenarios/operation-parameters/only_required.md +0 -58
  196. package/test/scenarios/operation-parameters/reserved_names.md +0 -60
  197. package/test/scenarios/operation-parameters/spread_body.md +0 -70
  198. package/test/scenarios/operation-parameters/spread_with_nested.md +0 -82
  199. package/test/scenarios/operation-parameters/union_body.md +0 -86
  200. package/test/scenarios/operation-parameters/with_body_property.md +0 -67
  201. package/test/scenarios/operation-parameters/with_body_root.md +0 -69
  202. package/test/scenarios/serializers/arrays.md +0 -191
  203. package/test/scenarios/serializers/basic_model.md +0 -111
  204. package/test/scenarios/serializers/basic_model_wire_name.md +0 -48
  205. package/test/scenarios/serializers/discriminated_union.md +0 -86
  206. package/test/scenarios/serializers/discriminated_union_spread.md +0 -115
  207. package/test/scenarios/serializers/file.md +0 -67
  208. package/test/scenarios/serializers/model_date_time.md +0 -65
  209. package/test/scenarios/serializers/multipart.md +0 -62
  210. package/test/scenarios/serializers/polymorphic_single_level_inheritance.md +0 -157
  211. package/test/scenarios/serializers/property_references_property.md +0 -72
  212. package/test/scenarios/serializers/record.md +0 -97
  213. package/test/scenarios/serializers/scalars.md +0 -34
  214. package/test/scenarios/serializers/spread.md +0 -69
  215. package/test/scenarios/serializers/string_union.md +0 -55
  216. package/test/scenarios/server/default_url.md +0 -45
  217. package/test/scenarios/server/multiple-parameters.md +0 -55
  218. package/test/scenarios/server/no-server.md +0 -37
  219. package/test/scenarios/server/parametrized-endpoint.md +0 -51
  220. package/test/scenarios.test.ts +0 -24
  221. package/test/test-host.ts +0 -22
  222. package/tsconfig.json +0 -16
  223. package/tsconfig.test.json +0 -9
  224. package/vitest.config.e2e.ts +0 -16
  225. package/vitest.config.ts +0 -15
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@typespec/http-client-js",
3
- "version": "0.16.2-dev.1",
3
+ "version": "0.16.2",
4
4
  "type": "module",
5
5
  "homepage": "https://typespec.io",
6
6
  "readme": "https://github.com/microsoft/typespec/blob/main/packages/http-client-js/README.md",
@@ -16,6 +16,10 @@
16
16
  "import": "./dist/src/components/index.js"
17
17
  }
18
18
  },
19
+ "files": [
20
+ "dist/**",
21
+ "!dist/test/**"
22
+ ],
19
23
  "keywords": [
20
24
  "typespec",
21
25
  "javascript",
@@ -28,40 +32,40 @@
28
32
  "license": "MIT",
29
33
  "description": "TypeSpec library for emitting Http Client libraries for JavaScript/TypeScript",
30
34
  "peerDependencies": {
31
- "@typespec/compiler": "^1.15.0 || >= 1.16.0-dev.0",
32
- "@typespec/http": "^1.15.0 || >= 1.16.0-dev.0",
33
- "@typespec/rest": "^0.85.0 || >= 0.86.0-dev.0"
35
+ "@typespec/compiler": "^1.16.0",
36
+ "@typespec/http": "^1.16.0",
37
+ "@typespec/rest": "^0.86.0"
34
38
  },
35
39
  "dependencies": {
36
40
  "@alloy-js/core": "^0.24.1",
37
41
  "@alloy-js/typescript": "^0.24.0",
38
- "@typespec/emitter-framework": "^0.20.0 || >= 0.20.1-dev.0",
39
- "@typespec/http-client": "^0.16.0 || >= 0.16.1-dev.0",
40
- "prettier": "^3.9.5"
42
+ "prettier": "^3.9.6",
43
+ "@typespec/emitter-framework": "^0.21.0",
44
+ "@typespec/http-client": "^0.17.0"
41
45
  },
42
46
  "devDependencies": {
43
47
  "@alloy-js/cli": "^0.24.0",
44
48
  "@alloy-js/rollup-plugin": "^0.1.2",
45
49
  "@types/yargs": "^17.0.35",
46
- "@typespec/http": "^1.15.0 || >= 1.16.0-dev.0",
47
- "@typespec/http-specs": "^0.1.0-alpha.41 || >= 0.1.0-alpha.42-dev.0",
48
- "@typespec/spector": "^0.1.0-alpha.28 || >= 0.1.0-alpha.29-dev.0",
49
- "@typespec/ts-http-runtime": "0.3.7",
50
- "@typespec/tspd": "^0.77.0 || >= 0.77.1-dev.0",
51
- "@typespec/versioning": "^0.85.0 || >= 0.86.0-dev.0",
52
- "@vitest/ui": "^4.1.3",
50
+ "@typespec/ts-http-runtime": "0.3.8",
51
+ "@vitest/ui": "^4.1.11",
53
52
  "change-case": "^5.4.4",
54
- "concurrently": "^10.0.4",
53
+ "concurrently": "^10.0.5",
55
54
  "cross-env": "^10.1.0",
56
55
  "execa": "^9.6.1",
57
- "@inquirer/prompts": "^8.4.1",
58
- "ora": "^9.3.0",
59
- "p-limit": "^7.3.0",
56
+ "@inquirer/prompts": "^8.6.0",
57
+ "ora": "^9.4.1",
58
+ "p-limit": "^7.3.1",
60
59
  "picocolors": "^1.1.1",
61
60
  "typescript": "~6.0.2",
62
61
  "uri-template": "^2.0.0",
63
- "vitest": "^4.1.3",
64
- "yargs": "^18.0.0"
62
+ "vitest": "^4.1.11",
63
+ "yargs": "^18.1.0",
64
+ "@typespec/http": "^1.16.0",
65
+ "@typespec/http-specs": "^0.1.0-alpha.42",
66
+ "@typespec/spector": "^0.1.0-alpha.29",
67
+ "@typespec/tspd": "^0.77.1",
68
+ "@typespec/versioning": "^0.86.0"
65
69
  },
66
70
  "scripts": {
67
71
  "build": "alloy build",
@@ -1,180 +0,0 @@
1
- > **Scope**: These instructions apply **only** to the `packages/http-client-js` sub-project in this monorepo. Use them whenever Copilot generates code, tests, commit messages, or pull request descriptions for the emitter. If Copilot is used in other sub-projects, these rules do not apply unless stated otherwise.
2
-
3
- ---
4
-
5
- ## 1. Code Generation Instructions
6
-
7
- - **Project Purpose**
8
- We are building a TypeSpec Emitter that generates JavaScript (TypeScript) HTTP clients.
9
-
10
- - **Language & Modules**
11
- - Always generate TypeScript using **ES Modules**.
12
- - Do **not** use `require` or `__dirname`.
13
- - Do **not** introduce new dependencies or frameworks without explicit approval.
14
-
15
- - **Core Stack**
16
- 1. **TypeSpec Compiler & Libraries**
17
- - `@typespec/compiler`, `@typespec/http`, `@typespec/emitter-framework`, `@typespec/http-client`
18
- - Activate typekits by importing:
19
- ```ts
20
- import { $ } from "@typespec/compiler/experimental/typekit";
21
- import "@typespec/http/experimental/typekit";
22
- ```
23
- 2. **Alloy-JS**
24
- - `@alloy-js/core` + `@alloy-js/typescript` for templating code with JSX-like syntax.
25
- - **`@typespec/emitter-framework/typescript`** offers higher-level React-like components (e.g., `<ef.InterfaceDeclaration type={model} />`) for converting TypeSpec types to TypeScript code.
26
- 3. **No React**
27
- - Alloy-JS syntax **resembles** React but is implemented independently. Don’t import React libraries.
28
-
29
- - **Emitter Implementation**
30
- - Implement `$onEmit` to hook into TypeSpec’s compiler. For example:
31
- ```ts
32
- export async function $onEmit(program: Program, emitterOptions: MyEmitterOptions) {
33
- // Query the type graph using program.checker, typekits, etc.
34
- // Generate TypeScript code using Alloy-JS.
35
- }
36
- ```
37
- - Parse TypeSpec’s type graph to gather HTTP metadata (e.g., operations, models) and emit TypeScript code using Alloy-JS components.
38
-
39
- - **Coding Style**
40
- - Follow **SOLID** and **KISS** principles.
41
- - Use TypeScript best practices; keep your code readable and reusable.
42
- - Write **JSDoc** for public/exported functions or classes.
43
- - Add inline comments for non-obvious logic or design decisions.
44
- - Favor clarity over cleverness, particularly for new developer onboarding.
45
-
46
- ---
47
-
48
- ## 2. Test Generation Instructions
49
-
50
- - **Test Format**
51
- - Use **literate tests** in Markdown files under `test/scenarios/**/*.md`.
52
- - Each test file typically has:
53
- 1. `# [TestTitle]`: High-level description of the scenario being tested.
54
- 2. `## Spec`: Contains a TypeSpec snippet as input for the emitter.
55
- 3. `## [Test Expectation]`: Contains code blocks showing the _expected_ generated code.
56
-
57
- - **Example**
58
-
59
- ```md
60
- # [MyTest]
61
-
62
- Tests generating a client for a simple model.
63
-
64
- ## Spec
65
-
66
- \`\`\`tsp
67
- namespace Test;
68
- model Foo { name: string; }
69
- @get op getFoo(): Foo;
70
- \`\`\`
71
-
72
- ## [Test Expectation]
73
-
74
- \`\`\`ts path/to/generated.ts function jsonFooToTransportTransform
75
- export function jsonFooToTransportTransform(input: Foo) {
76
- // This is the expected code snippet
77
- }
78
- \`\`\`
79
- ```
80
-
81
- - **Implementation**
82
- - Use the `@typespec/emitter-framework` test harness to process these `.md` files and validate generated outputs.
83
- - Do **not** add extra test libraries (e.g., Jest, Mocha). The built-in harness is sufficient.
84
-
85
- - There should only be a single tsp code block per h1 (#) heading.
86
- - H1 Headings translate to describe blocks in vitest
87
- - ts codeblocks translate to it blocks in vitest.
88
- - !NEVER modify existing ts or tsp code blocks
89
-
90
- ---
91
-
92
- ## 3. Code Review Instructions
93
-
94
- - **Review Criteria**
95
- - Confirm ES Module usage (no `require`).
96
- - Check that code remains **SOLID** and not over-engineered.
97
- - Ensure public functions are documented with JSDoc.
98
- - Verify usage of the correct TypeSpec or Alloy-JS APIs (e.g., `$onEmit`, `<ef.InterfaceDeclaration>`, etc.).
99
- - If logic is complex, suggest more inline comments or a concise doc block.
100
-
101
- - **No Unauthorized Dependencies**
102
- - Code reviewers should flag any added libraries or frameworks without explicit approval.
103
-
104
- ---
105
-
106
- ## 4. Commit Message Generation
107
-
108
- - **Format**
109
-
110
- ```
111
- <type>(<scope>): <description>
112
- ```
113
-
114
- Examples:
115
- - `feat(emitter): add support for generating query parameters`
116
- - `fix(api): handle empty model in TypeSpec`
117
-
118
- - **Scopes**
119
- - `emitter` for changes in emitter code
120
- - `compiler` for changes in TypeSpec compiler logic
121
- - `test` for changes to the literate tests
122
-
123
- - **Automation & Strictness**
124
- - Copilot may suggest commit messages, but they **must** follow this conventional format.
125
- - Keep commit messages self-contained (no external links).
126
-
127
- ---
128
-
129
- ## 5. Pull Request Title & Description
130
-
131
- - **Title**
132
- - Same format as commits: `<type>(<scope>): <description>`.
133
- - **Body**
134
- 1. **Why** this change is needed
135
- 2. **What** has changed
136
- 3. **How** to test or verify (if relevant)
137
- 4. **Implications** on emitter output or user-facing APIs
138
-
139
- - **Keep it Brief**
140
- - Provide enough context for the reviewer without unnecessary details.
141
-
142
- ---
143
-
144
- ## 6. Context Management
145
-
146
- - **Random Emoji**
147
- - Prepend a random emoji at the beginning of **every** generated response.
148
- - **Summaries**
149
- - Periodically generate concise summaries of progress or changes.
150
- - Write or append these summaries to `.github/context/[timestamp]-context-summary.md`.
151
- - **No Additional Dependencies**
152
- - Implement emoji generation or summary logic with built-in JS features only.
153
-
154
- ***
155
-
156
- ## 7. Debugging and Troubleshooting
157
-
158
- - **TypeSpec Type System**
159
- - When investigating issues, understand that TypeSpec has a complex type system with these key concepts:
160
- - **Type References**: Types can reference other types (e.g., `ModelProperty` can reference another `ModelProperty`)
161
- - **Type Unpacking**: Many types need to be "unpacked" to get their underlying type (e.g., `HttpPart`, `ModelProperty`, etc.)
162
- - **Typekits**: Use `$` from `@typespec/compiler/experimental/typekit` to check type kinds (e.g., `$.modelProperty.is()`)
163
-
164
- - **Common Transformation Patterns**
165
- - Transforms like `JsonTransform` have this general flow:
166
- 1. Check for a declared transform reference
167
- 2. Switch on the type kind (Model, Union, ModelProperty, etc.)
168
- 3. Route to the appropriate specialized transform
169
- 4. Generate code with property accessors
170
-
171
- - **Debugging Strategies**
172
- - **Type Inspection**: For type-related bugs, check what the actual TypeSpec type is at each step
173
- - **Transform Chain**: Follow the transformation chain from root component to leaf components
174
- - **Recursive Handling**: Pay special attention to places where types are handled recursively
175
- - **Edge Cases**: Look for special cases like nullable types, union types, and type references
176
-
177
- - **Common Issues**
178
- - **Duplicated Properties**: Check property reference resolution in transforms
179
- - **Missing Properties**: Verify type unpacking is complete at all points
180
- - **Type Mismatches**: Ensure the right transform is being selected for each type kind
package/.testignore DELETED
@@ -1,19 +0,0 @@
1
- # Shadowing issue
2
-
3
- type/model/usage
4
-
5
- # Streams
6
-
7
- streaming
8
-
9
- # discriminated union issue - https://github.com/microsoft/typespec/issues/7134
10
-
11
- type/union/discriminated
12
-
13
- # Multipart - https://github.com/microsoft/typespec/issues/9155
14
-
15
- payload/multipart
16
-
17
- # Body root issues - https://github.com/microsoft/typespec/issues/10877
18
-
19
- parameters/body-root
@@ -1,3 +0,0 @@
1
- $ alloy build
2
-
3
- ✔ Build completed successfully in 1499ms
package/CHANGELOG.md DELETED
@@ -1,159 +0,0 @@
1
- # Changelog - @typespec/http-client-js
2
-
3
- ## 0.16.1
4
-
5
- No changes, version bump only.
6
-
7
- ## 0.16.0
8
-
9
- ### Deprecations
10
-
11
- - [#10964](https://github.com/microsoft/typespec/pull/10964) Deprecate old testing framework (`createTestHost`, `createTestRunner`, `createTestWrapper`, `createTestLibrary`, `BasicTestRunner`, `TypeSpecTestLibrary`, etc.). Use `createTester` from `@typespec/compiler/testing` instead.
12
-
13
-
14
- ## 0.15.0
15
-
16
- Manual release due to dependencies upgrade.
17
-
18
- ## 0.14.1
19
-
20
- ### Bump dependencies
21
-
22
- - [#9838](https://github.com/microsoft/typespec/pull/9838) Upgrade dependencies
23
-
24
-
25
- ## 0.14.0
26
-
27
- ### Bump dependencies
28
-
29
- - [#9446](https://github.com/microsoft/typespec/pull/9446) Upgrade dependencies
30
-
31
-
32
- ## 0.13.0
33
-
34
- ### Bump dependencies
35
-
36
- - [#9202](https://github.com/microsoft/typespec/pull/9202) Update to alloy 0.22
37
- - [#9223](https://github.com/microsoft/typespec/pull/9223) Upgrade dependencies
38
-
39
-
40
- ## 0.12.0
41
-
42
- ### Bump dependencies
43
-
44
- - [#9046](https://github.com/microsoft/typespec/pull/9046) Upgrade dependencies
45
-
46
-
47
- ## 0.11.0
48
-
49
- ### Bump dependencies
50
-
51
- - [#8823](https://github.com/microsoft/typespec/pull/8823) Upgrade dependencies
52
-
53
-
54
- ## 0.10.0
55
-
56
- ### Bug Fixes
57
-
58
- - [#8613](https://github.com/microsoft/typespec/pull/8613) Remove warning when no explicit content type is provided to a multipart part
59
-
60
-
61
- ## 0.9.0
62
-
63
- ### Features
64
-
65
- - [#8145](https://github.com/microsoft/typespec/pull/8145) Enable component overrides for extensibility
66
-
67
- ### Bump dependencies
68
-
69
- - [#8317](https://github.com/microsoft/typespec/pull/8317) Upgrade dependencies
70
-
71
- ### Bug Fixes
72
-
73
- - [#8362](https://github.com/microsoft/typespec/pull/8362) Upgrade alloy to 0.20
74
-
75
-
76
- ## 0.8.0
77
-
78
- ### Bump dependencies
79
-
80
- - [#8050](https://github.com/microsoft/typespec/pull/8050) Upgrade alloy 0.19
81
- - [#7978](https://github.com/microsoft/typespec/pull/7978) Upgrade dependencies
82
-
83
- ### Bug Fixes
84
-
85
- - [#8056](https://github.com/microsoft/typespec/pull/8056) Fix the missing `main` field issue in package.json
86
-
87
-
88
- ## 0.7.0
89
-
90
- ### Bump dependencies
91
-
92
- - [#7655](https://github.com/microsoft/typespec/pull/7655) Upgrade to alloy 0.18.0
93
- - [#7674](https://github.com/microsoft/typespec/pull/7674) Upgrade dependencies
94
-
95
- ### Bug Fixes
96
-
97
- - [#6477](https://github.com/microsoft/typespec/pull/6477) Bypass nested paging compile issue
98
-
99
- ## 0.6.0
100
-
101
- ### Features
102
-
103
- - [#7039](https://github.com/microsoft/typespec/pull/7039) Export some of the components for reuse.
104
- - [#7409](https://github.com/microsoft/typespec/pull/7409) Emit TypeSpec comments as JSDoc in TypeScript components
105
-
106
- ### Bump dependencies
107
-
108
- - [#7605](https://github.com/microsoft/typespec/pull/7605) Updates alloy to 0.17
109
- - [#7363](https://github.com/microsoft/typespec/pull/7363) Upgrade alloy 16
110
- - [#7323](https://github.com/microsoft/typespec/pull/7323) Upgrade dependencies
111
-
112
- ### Bug Fixes
113
-
114
- - [#7194](https://github.com/microsoft/typespec/pull/7194) Emit correct diagnostic for unsupported API key auth
115
-
116
- ## 0.5.0
117
-
118
- ### Bump dependencies
119
-
120
- - [#7186](https://github.com/microsoft/typespec/pull/7186) Upgrade to alloy 15
121
-
122
- ## 0.4.0
123
-
124
- ### Features
125
-
126
- - [#6875](https://github.com/microsoft/typespec/pull/6875) Upgrade to alloy 0.10.0
127
- - [#6709](https://github.com/microsoft/typespec/pull/6709) Add support for OAuth2 authentication scheme
128
- - [#6725](https://github.com/microsoft/typespec/pull/6725) Add paging support
129
-
130
- ### Bump dependencies
131
-
132
- - [#7017](https://github.com/microsoft/typespec/pull/7017) Alloy 0.11
133
-
134
- ### Bug Fixes
135
-
136
- - [#6899](https://github.com/microsoft/typespec/pull/6899) Fix File serialization issue and enable building e2e tests
137
-
138
- ## 0.3.0
139
-
140
- ### Bump dependencies
141
-
142
- - [#6595](https://github.com/microsoft/typespec/pull/6595) Upgrade dependencies
143
-
144
- ## 0.2.0
145
-
146
- ### Deprecations
147
-
148
- - [#6306](https://github.com/microsoft/typespec/pull/6306) Remove the use of deprecated getDiscriminatedUnion
149
-
150
- ### Features
151
-
152
- - [#6178](https://github.com/microsoft/typespec/pull/6178) Introducing the JS Http Client emitter
153
-
154
- ### Bug Fixes
155
-
156
- - [#6460](https://github.com/microsoft/typespec/pull/6460) Update dependency structure for EmitterFramework, HttpClient and JS Emitter
157
- - [#6390](https://github.com/microsoft/typespec/pull/6390) Fix Multipart handling for model with @body
158
- - [#6348](https://github.com/microsoft/typespec/pull/6348) handle model property references in union types correctly
159
- - [#6286](https://github.com/microsoft/typespec/pull/6286) Replace @discriminator union with @discriminated
@@ -1,33 +0,0 @@
1
- /* eslint-disable no-console */
2
-
3
- import { readFile } from "fs/promises";
4
- import { join } from "path";
5
- import pc from "picocolors";
6
-
7
- const coverageFilePath = join(
8
- import.meta.dirname,
9
- "../../temp",
10
- "tsp-spector-coverage-javascript-standard.json",
11
- );
12
-
13
- /** Calculates and prints Spector coverage from the local coverage artifact. */
14
- export async function calculateCoverage(): Promise<void> {
15
- try {
16
- console.log(pc.blue(`Reading coverage file from: ${coverageFilePath}`));
17
- const data = await readFile(coverageFilePath, "utf8");
18
-
19
- const coverage = JSON.parse(data) as Array<{ results: Record<string, string> }>;
20
-
21
- const results = coverage[0].results;
22
- const totalTests = Object.keys(results).length;
23
- const passedTests = Object.values(results).filter((status) => status === "pass").length;
24
-
25
- const coveragePercentage = (passedTests / totalTests) * 100;
26
-
27
- console.log(pc.bold(pc.gray(`Total Tests: ${totalTests}`)));
28
- console.log(pc.bold(pc.green(`Passed Tests: ${passedTests}`)));
29
- console.log(pc.bold(pc.green(`Coverage Percentage: ${coveragePercentage.toFixed(2)}%`)));
30
- } catch (error) {
31
- console.error(pc.red("Error calculating coverage:"), error);
32
- }
33
- }