@typespec/http-client-js 0.12.0 → 0.13.0-dev.1

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 (36) hide show
  1. package/dist/src/components/external-packages/ts-http-runtime.d.ts +1 -1
  2. package/dist/src/components/external-packages/ts-http-runtime.d.ts.map +1 -1
  3. package/dist/src/components/external-packages/uri-template.d.ts +1 -1
  4. package/dist/src/components/external-packages/uri-template.d.ts.map +1 -1
  5. package/dist/src/components/http-request.d.ts.map +1 -1
  6. package/dist/src/components/http-request.js +2 -2
  7. package/dist/src/components/http-request.js.map +1 -1
  8. package/dist/tsconfig.tsbuildinfo +1 -1
  9. package/package.json +15 -15
  10. package/src/components/http-request.tsx +2 -1
  11. package/test/scenarios/auth/basic_auth.md +0 -1
  12. package/test/scenarios/auth/bearer.md +0 -1
  13. package/test/scenarios/auth/client_parameters.md +0 -1
  14. package/test/scenarios/auth/key_credential.md +0 -1
  15. package/test/scenarios/auth/oauth2.md +0 -1
  16. package/test/scenarios/auth/sub_client_override.md +0 -2
  17. package/test/scenarios/client/dotted_namespace.md +0 -1
  18. package/test/scenarios/client/global_namespace.md +0 -1
  19. package/test/scenarios/client/multiple_top_level_clients.md +0 -2
  20. package/test/scenarios/client/nested_client.md +0 -1
  21. package/test/scenarios/http-operations/basic.md +0 -1
  22. package/test/scenarios/http-operations/paging.md +0 -2
  23. package/test/scenarios/http-operations/with-parameters.md +0 -1
  24. package/test/scenarios/operation-parameters/body_root_anonymous.md +0 -1
  25. package/test/scenarios/operation-parameters/constant_as_optional.md +0 -1
  26. package/test/scenarios/operation-parameters/default_value_as_optional.md +0 -1
  27. package/test/scenarios/operation-parameters/no_content_type.md +0 -1
  28. package/test/scenarios/operation-parameters/no_parameters.md +0 -1
  29. package/test/scenarios/operation-parameters/only_optional.md +0 -1
  30. package/test/scenarios/operation-parameters/only_required.md +0 -1
  31. package/test/scenarios/operation-parameters/reserved_names.md +0 -1
  32. package/test/scenarios/operation-parameters/spread_body.md +0 -1
  33. package/test/scenarios/operation-parameters/spread_with_nested.md +0 -1
  34. package/test/scenarios/operation-parameters/union_body.md +0 -1
  35. package/test/scenarios/operation-parameters/with_body_property.md +0 -1
  36. package/test/scenarios/operation-parameters/with_body_root.md +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@typespec/http-client-js",
3
- "version": "0.12.0",
3
+ "version": "0.13.0-dev.1",
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",
@@ -29,21 +29,26 @@
29
29
  "description": "TypeSpec library for emitting Http Client libraries for JavaScript/TypeScript",
30
30
  "peerDependencies": {
31
31
  "@typespec/compiler": "^1.7.0",
32
- "@typespec/rest": "^0.77.0",
33
- "@typespec/http": "^1.7.0"
32
+ "@typespec/http": "^1.7.0",
33
+ "@typespec/rest": "^0.77.0 || >=0.78.0-dev <0.78.0"
34
34
  },
35
35
  "dependencies": {
36
- "@alloy-js/core": "^0.21.0",
37
- "@alloy-js/typescript": "^0.21.0",
38
- "prettier": "~3.6.2",
39
- "@typespec/http-client": "^0.13.0",
40
- "@typespec/emitter-framework": "^0.14.0"
36
+ "@alloy-js/core": "^0.22.0",
37
+ "@alloy-js/typescript": "^0.22.0",
38
+ "@typespec/emitter-framework": "^0.14.0 || >=0.15.0-dev <0.15.0",
39
+ "@typespec/http-client": "^0.13.0 || >=0.14.0-dev <0.14.0",
40
+ "prettier": "~3.6.2"
41
41
  },
42
42
  "devDependencies": {
43
- "@alloy-js/cli": "^0.21.0",
43
+ "@alloy-js/cli": "^0.22.0",
44
44
  "@alloy-js/rollup-plugin": "^0.1.0",
45
45
  "@types/yargs": "~17.0.33",
46
+ "@typespec/http": "^1.7.0",
47
+ "@typespec/http-specs": "^0.1.0-alpha.29 || >=0.1.0-alpha.30-dev <0.1.0-alpha.30",
48
+ "@typespec/spector": "^0.1.0-alpha.21 || >=0.1.0-alpha.22-dev <0.1.0-alpha.22",
46
49
  "@typespec/ts-http-runtime": "0.3.2",
50
+ "@typespec/tspd": "^0.73.2 || >=0.74.0-dev <0.74.0",
51
+ "@typespec/versioning": "^0.77.0 || >=0.78.0-dev <0.78.0",
47
52
  "@vitest/ui": "^4.0.4",
48
53
  "change-case": "~5.4.4",
49
54
  "concurrently": "^9.1.2",
@@ -58,12 +63,7 @@
58
63
  "typescript": "~5.9.2",
59
64
  "uri-template": "^2.0.0",
60
65
  "vitest": "^4.0.4",
61
- "yargs": "~18.0.0",
62
- "@typespec/http": "^1.7.0",
63
- "@typespec/http-specs": "^0.1.0-alpha.29",
64
- "@typespec/spector": "^0.1.0-alpha.21",
65
- "@typespec/tspd": "^0.73.2",
66
- "@typespec/versioning": "^0.77.0"
66
+ "yargs": "~18.0.0"
67
67
  },
68
68
  "scripts": {
69
69
  "build": "alloy build",
@@ -38,8 +38,9 @@ export function HttpRequest(props: HttpRequestProps) {
38
38
  await client.pathUnchecked(${(<Reference refkey={operationUrlRefkey} />)}).${verb}(${(<Reference refkey={requestOptionsVarRefkey} />)})
39
39
  `}
40
40
  </ts.VarDeclaration>
41
- <hbr />
42
41
  </StatementList>
42
+ <hbr />
43
+ <hbr />
43
44
  {code`
44
45
  if (typeof options?.operationOptions?.onResponse === "function") {
45
46
  options?.operationOptions?.onResponse(response);
@@ -25,7 +25,6 @@ The client signature should include a positional parameter for credential of typ
25
25
  ```ts src/testClient.ts class TestClient
26
26
  export class TestClient {
27
27
  #context: TestClientContext;
28
-
29
28
  constructor(endpoint: string, credential: BasicCredential, options?: TestClientOptions) {
30
29
  this.#context = createTestClientContext(endpoint, credential, options);
31
30
  }
@@ -25,7 +25,6 @@ The client signature should include a positional parameter for credential of typ
25
25
  ```ts src/testClient.ts class TestClient
26
26
  export class TestClient {
27
27
  #context: TestClientContext;
28
-
29
28
  constructor(endpoint: string, credential: BasicCredential, options?: TestClientOptions) {
30
29
  this.#context = createTestClientContext(endpoint, credential, options);
31
30
  }
@@ -26,7 +26,6 @@ TODO: Revisit if we need additional types since it will be difficult at runtime
26
26
  ```ts src/testClient.ts class TestClient
27
27
  export class TestClient {
28
28
  #context: TestClientContext;
29
-
30
29
  constructor(
31
30
  endpoint: string,
32
31
  credential: BearerTokenCredential | ApiKeyCredential,
@@ -25,7 +25,6 @@ The client signature should include a positional parameter for credential of typ
25
25
  ```ts src/testClient.ts class TestClient
26
26
  export class TestClient {
27
27
  #context: TestClientContext;
28
-
29
28
  constructor(endpoint: string, credential: ApiKeyCredential, options?: TestClientOptions) {
30
29
  this.#context = createTestClientContext(endpoint, credential, options);
31
30
  }
@@ -36,7 +36,6 @@ The client signature should include a positional parameter for credential of typ
36
36
  ```ts src/testClient.ts class TestClient
37
37
  export class TestClient {
38
38
  #context: TestClientContext;
39
-
40
39
  constructor(
41
40
  endpoint: string,
42
41
  credential: OAuth2TokenCredential<ClientCredentialsFlow>,
@@ -34,7 +34,6 @@ The subclient is not a child of the TestClient because they have different param
34
34
  ```ts src/testClient.ts class TestClient
35
35
  export class TestClient {
36
36
  #context: TestClientContext;
37
-
38
37
  constructor(endpoint: string, credential: BasicCredential, options?: TestClientOptions) {
39
38
  this.#context = createTestClientContext(endpoint, credential, options);
40
39
  }
@@ -49,7 +48,6 @@ The sub client shouldn't take a credential
49
48
  ```ts src/testClient.ts class SubClient
50
49
  export class SubClient {
51
50
  #context: SubClientContext;
52
-
53
51
  constructor(endpoint: string, options?: SubClientOptions) {
54
52
  this.#context = createSubClientContext(endpoint, options);
55
53
  }
@@ -17,7 +17,6 @@ The client should match the last namespace.
17
17
  ```ts src/bazClient.ts class BazClient
18
18
  export class BazClient {
19
19
  #context: BazClientContext;
20
-
21
20
  constructor(endpoint: string, options?: BazClientOptions) {
22
21
  this.#context = createBazClientContext(endpoint, options);
23
22
  }
@@ -39,7 +39,6 @@ It should generate a client for the Global Namespace with a single operation `fo
39
39
  ```ts src/client.ts class Client
40
40
  export class Client {
41
41
  #context: ClientContext;
42
-
43
42
  constructor(endpoint: string, options?: ClientOptions) {
44
43
  this.#context = createClientContext(endpoint, options);
45
44
  }
@@ -37,7 +37,6 @@ import { get, type GetOptions } from "./api/fooClientOperations.js";
37
37
 
38
38
  export class FooClient {
39
39
  #context: FooClientContext;
40
-
41
40
  constructor(endpoint: string, options?: FooClientOptions) {
42
41
  this.#context = createFooClientContext(endpoint, options);
43
42
  }
@@ -60,7 +59,6 @@ import type { BarItem } from "./models/models.js";
60
59
 
61
60
  export class BarClient {
62
61
  #context: BarClientContext;
63
-
64
62
  constructor(endpoint: string, options?: BarClientOptions) {
65
63
  this.#context = createBarClientContext(endpoint, options);
66
64
  }
@@ -77,7 +77,6 @@ export class DemoServiceClient {
77
77
  }
78
78
  export class WidgetsClient {
79
79
  #context: WidgetsClientContext;
80
-
81
80
  constructor(endpoint: string, options?: WidgetsClientOptions) {
82
81
  this.#context = createWidgetsClientContext(endpoint, options);
83
82
  }
@@ -32,7 +32,6 @@ import { foo, type FooOptions } from "./api/testClientOperations.js";
32
32
 
33
33
  export class TestClient {
34
34
  #context: TestClientContext;
35
-
36
35
  constructor(endpoint: string, options?: TestClientOptions) {
37
36
  this.#context = createTestClientContext(endpoint, options);
38
37
  }
@@ -110,7 +110,6 @@ export interface LinkPageResponse {
110
110
  ```ts src/testClient.ts class TestClient
111
111
  export class TestClient {
112
112
  #context: TestClientContext;
113
-
114
113
  constructor(endpoint: string, options?: TestClientOptions) {
115
114
  this.#context = createTestClientContext(endpoint, options);
116
115
  }
@@ -233,7 +232,6 @@ export interface LinkPageResponse {
233
232
  ```ts src/testClient.ts class TestClient
234
233
  export class TestClient {
235
234
  #context: TestClientContext;
236
-
237
235
  constructor(endpoint: string, options?: TestClientOptions) {
238
236
  this.#context = createTestClientContext(endpoint, options);
239
237
  }
@@ -68,7 +68,6 @@ It should generate the client class with the read operation that calls the opera
68
68
  ```ts src/demoServiceClient.ts class WidgetsClient
69
69
  export class WidgetsClient {
70
70
  #context: WidgetsClientContext;
71
-
72
71
  constructor(endpoint: string, options?: WidgetsClientOptions) {
73
72
  this.#context = createWidgetsClientContext(endpoint, options);
74
73
  }
@@ -69,7 +69,6 @@ export interface CreateOptions extends OperationOptions {
69
69
  ```ts src/testClient.ts class TestClient
70
70
  export class TestClient {
71
71
  #context: TestClientContext;
72
-
73
72
  constructor(endpoint: string, options?: TestClientOptions) {
74
73
  this.#context = createTestClientContext(endpoint, options);
75
74
  }
@@ -44,7 +44,6 @@ export interface GetOptions extends OperationOptions {
44
44
  ```ts src/testClient.ts class TestClient
45
45
  export class TestClient {
46
46
  #context: TestClientContext;
47
-
48
47
  constructor(endpoint: string, options?: TestClientOptions) {
49
48
  this.#context = createTestClientContext(endpoint, options);
50
49
  }
@@ -44,7 +44,6 @@ export interface GetOptions extends OperationOptions {
44
44
  ```ts src/testClient.ts class TestClient
45
45
  export class TestClient {
46
46
  #context: TestClientContext;
47
-
48
47
  constructor(endpoint: string, options?: TestClientOptions) {
49
48
  this.#context = createTestClientContext(endpoint, options);
50
49
  }
@@ -52,7 +52,6 @@ export interface GetOptions extends OperationOptions {}
52
52
  ```ts src/testClient.ts class TestClient
53
53
  export class TestClient {
54
54
  #context: TestClientContext;
55
-
56
55
  constructor(endpoint: string, options?: TestClientOptions) {
57
56
  this.#context = createTestClientContext(endpoint, options);
58
57
  }
@@ -40,7 +40,6 @@ export interface GetOptions extends OperationOptions {}
40
40
  ```ts src/testClient.ts class TestClient
41
41
  export class TestClient {
42
42
  #context: TestClientContext;
43
-
44
43
  constructor(endpoint: string, options?: TestClientOptions) {
45
44
  this.#context = createTestClientContext(endpoint, options);
46
45
  }
@@ -52,7 +52,6 @@ export interface GetWithParamsOptions extends OperationOptions {
52
52
  ```ts src/testClient.ts class TestClient
53
53
  export class TestClient {
54
54
  #context: TestClientContext;
55
-
56
55
  constructor(endpoint: string, options?: TestClientOptions) {
57
56
  this.#context = createTestClientContext(endpoint, options);
58
57
  }
@@ -48,7 +48,6 @@ export interface GetWithParamsOptions extends OperationOptions {}
48
48
  ```ts src/testClient.ts class TestClient
49
49
  export class TestClient {
50
50
  #context: TestClientContext;
51
-
52
51
  constructor(endpoint: string, options?: TestClientOptions) {
53
52
  this.#context = createTestClientContext(endpoint, options);
54
53
  }
@@ -50,7 +50,6 @@ export interface GetOptions extends OperationOptions {
50
50
  ```ts src/testClient.ts class TestClient
51
51
  export class TestClient {
52
52
  #context: TestClientContext;
53
-
54
53
  constructor(endpoint: string, options?: TestClientOptions) {
55
54
  this.#context = createTestClientContext(endpoint, options);
56
55
  }
@@ -60,7 +60,6 @@ export interface CreateOptions extends OperationOptions {
60
60
  ```ts src/testClient.ts class TestClient
61
61
  export class TestClient {
62
62
  #context: TestClientContext;
63
-
64
63
  constructor(endpoint: string, options?: TestClientOptions) {
65
64
  this.#context = createTestClientContext(endpoint, options);
66
65
  }
@@ -72,7 +72,6 @@ export interface CreateOptions extends OperationOptions {
72
72
  ```ts src/testClient.ts class TestClient
73
73
  export class TestClient {
74
74
  #context: TestClientContext;
75
-
76
75
  constructor(endpoint: string, options?: TestClientOptions) {
77
76
  this.#context = createTestClientContext(endpoint, options);
78
77
  }
@@ -64,7 +64,6 @@ export interface SendOptions extends OperationOptions {}
64
64
  ```ts src/testClient.ts class TestClient
65
65
  export class TestClient {
66
66
  #context: TestClientContext;
67
-
68
67
  constructor(endpoint: string, options?: TestClientOptions) {
69
68
  this.#context = createTestClientContext(endpoint, options);
70
69
  }
@@ -57,7 +57,6 @@ export interface CreateOptions extends OperationOptions {
57
57
  ```ts src/testClient.ts class TestClient
58
58
  export class TestClient {
59
59
  #context: TestClientContext;
60
-
61
60
  constructor(endpoint: string, options?: TestClientOptions) {
62
61
  this.#context = createTestClientContext(endpoint, options);
63
62
  }
@@ -59,7 +59,6 @@ export interface CreateOptions extends OperationOptions {
59
59
  ```ts src/testClient.ts class TestClient
60
60
  export class TestClient {
61
61
  #context: TestClientContext;
62
-
63
62
  constructor(endpoint: string, options?: TestClientOptions) {
64
63
  this.#context = createTestClientContext(endpoint, options);
65
64
  }