@typespec/http-client-js 0.6.0-dev.5 → 0.6.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 (44) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/src/components/client-context/client-context-factory.js +1 -1
  3. package/dist/src/components/client-operation.d.ts.map +1 -1
  4. package/dist/src/components/client-operation.js +8 -4
  5. package/dist/src/components/client.js +3 -3
  6. package/dist/src/components/external-packages/ts-http-runtime.d.ts +2 -2
  7. package/dist/src/components/external-packages/ts-http-runtime.d.ts.map +1 -1
  8. package/dist/src/components/external-packages/uri-template.d.ts +2 -2
  9. package/dist/src/components/external-packages/uri-template.d.ts.map +1 -1
  10. package/dist/src/components/http-request-options.d.ts +3 -1
  11. package/dist/src/components/http-request-options.d.ts.map +1 -1
  12. package/dist/src/components/http-request-options.js +5 -3
  13. package/dist/src/components/http-request.d.ts +3 -1
  14. package/dist/src/components/http-request.d.ts.map +1 -1
  15. package/dist/src/components/http-request.js +14 -8
  16. package/dist/src/components/operation-handlers/paging/paginated-operation-handler.d.ts.map +1 -1
  17. package/dist/src/components/operation-handlers/paging/paginated-operation-handler.js +3 -2
  18. package/dist/src/components/operation-handlers/paging/request-send.d.ts.map +1 -1
  19. package/dist/src/components/operation-handlers/paging/request-send.js +15 -8
  20. package/dist/src/components/operation-handlers/paging/response-deserialize.d.ts +1 -0
  21. package/dist/src/components/operation-handlers/paging/response-deserialize.d.ts.map +1 -1
  22. package/dist/src/components/operation-handlers/paging/response-deserialize.js +5 -2
  23. package/dist/src/components/operation-parameters.d.ts +1 -2
  24. package/dist/src/components/operation-parameters.d.ts.map +1 -1
  25. package/dist/src/components/operation-parameters.js +3 -6
  26. package/dist/src/components/transforms/operation-transform-declaration.d.ts +1 -1
  27. package/dist/src/components/transforms/operation-transform-declaration.d.ts.map +1 -1
  28. package/dist/src/components/transforms/operation-transform-declaration.js +2 -5
  29. package/dist/src/utils/parameters.d.ts +2 -1
  30. package/dist/src/utils/parameters.d.ts.map +1 -1
  31. package/dist/src/utils/parameters.js +6 -6
  32. package/dist/tsconfig.tsbuildinfo +1 -1
  33. package/package.json +16 -16
  34. package/src/components/client-context/client-context-factory.tsx +1 -1
  35. package/src/components/client-operation.tsx +15 -3
  36. package/src/components/client.tsx +3 -3
  37. package/src/components/http-request-options.tsx +9 -5
  38. package/src/components/http-request.tsx +17 -9
  39. package/src/components/operation-handlers/paging/paginated-operation-handler.tsx +7 -2
  40. package/src/components/operation-handlers/paging/request-send.tsx +26 -11
  41. package/src/components/operation-handlers/paging/response-deserialize.tsx +6 -2
  42. package/src/components/operation-parameters.tsx +6 -7
  43. package/src/components/transforms/operation-transform-declaration.tsx +2 -5
  44. package/src/utils/parameters.tsx +9 -5
package/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # Changelog - @typespec/http-client-js
2
2
 
3
+ ## 0.6.0
4
+
5
+ ### Features
6
+
7
+ - [#7039](https://github.com/microsoft/typespec/pull/7039) Export some of the components for reuse.
8
+ - [#7409](https://github.com/microsoft/typespec/pull/7409) Emit TypeSpec comments as JSDoc in TypeScript components
9
+
10
+ ### Bump dependencies
11
+
12
+ - [#7605](https://github.com/microsoft/typespec/pull/7605) Updates alloy to 0.17
13
+ - [#7363](https://github.com/microsoft/typespec/pull/7363) Upgrade alloy 16
14
+ - [#7323](https://github.com/microsoft/typespec/pull/7323) Upgrade dependencies
15
+
16
+ ### Bug Fixes
17
+
18
+ - [#7194](https://github.com/microsoft/typespec/pull/7194) Emit correct diagnostic for unsupported API key auth
19
+
20
+
3
21
  ## 0.5.0
4
22
 
5
23
  ### Bump dependencies
@@ -21,7 +21,7 @@ export function ClientContextFactoryDeclaration(props) {
21
21
  const namePolicy = ts.useTSNamePolicy();
22
22
  const factoryFunctionName = namePolicy.getName(`create_${props.client.name}Context`, "function");
23
23
  const clientConstructor = $.client.getConstructor(props.client);
24
- const parameters = buildClientParameters(props.client);
24
+ const parameters = buildClientParameters(props.client, ay.refkey());
25
25
  const urlTemplate = $.client.getUrlTemplate(props.client);
26
26
  const endpointRef = ay.refkey();
27
27
  const resolvedEndpoint = _$createComponent(ParametrizedEndpoint, {
@@ -1 +1 @@
1
- {"version":3,"file":"client-operation.d.ts","sourceRoot":"","sources":["../../../src/components/client-operation.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAIrC,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAU5C,MAAM,WAAW,qBAAqB;IACpC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC;CACnB;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,eAqB5D;AAED,MAAM,WAAW,oBAAoB;IACnC,aAAa,EAAE,aAAa,CAAC;IAC7B,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,oBAAoB,eAwC1D"}
1
+ {"version":3,"file":"client-operation.d.ts","sourceRoot":"","sources":["../../../src/components/client-operation.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAIrC,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAU5C,MAAM,WAAW,qBAAqB;IACpC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC;CACnB;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,eAqB5D;AAED,MAAM,WAAW,oBAAoB;IACnC,aAAa,EAAE,aAAa,CAAC;IAC7B,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAMD,wBAAgB,eAAe,CAAC,KAAK,EAAE,oBAAoB,eAgD1D"}
@@ -36,10 +36,14 @@ export function ClientOperations(props) {
36
36
  }
37
37
  });
38
38
  }
39
+ function getClientOperationOptionsParamRef(httpOperation) {
40
+ return ay.refkey(httpOperation, "client-operation-options-parameter");
41
+ }
39
42
  export function ClientOperation(props) {
40
43
  const {
41
44
  $
42
45
  } = useTsp();
46
+ const optionsRefkey = getClientOperationOptionsParamRef(props.httpOperation);
43
47
  const clientLibrary = cl.useClientLibrary();
44
48
  const client = clientLibrary.getClientForOperation(props.httpOperation);
45
49
  if (!client) {
@@ -54,9 +58,8 @@ export function ClientOperation(props) {
54
58
  const clientContextInterfaceRef = getClientcontextDeclarationRef(client);
55
59
  const signatureParams = [{
56
60
  name: "client",
57
- type: clientContextInterfaceRef,
58
- refkey: ay.refkey(client, "client")
59
- }, ...getOperationParameters(props.httpOperation)];
61
+ type: clientContextInterfaceRef
62
+ }, ...getOperationParameters(props.httpOperation, optionsRefkey)];
60
63
  return _$createComponent(ay.List, {
61
64
  hardline: true,
62
65
  get children() {
@@ -90,7 +93,8 @@ export function ClientOperation(props) {
90
93
  get httpOperation() {
91
94
  return props.httpOperation;
92
95
  },
93
- responseRefkey: responseRefkey
96
+ responseRefkey: responseRefkey,
97
+ operationOptionsParamRefkey: optionsRefkey
94
98
  }), _$createComponent(HttpResponse, {
95
99
  get httpOperation() {
96
100
  return props.httpOperation;
@@ -84,7 +84,7 @@ export function ClientClass(props) {
84
84
  hardline: true,
85
85
  semicolon: true,
86
86
  children: op => {
87
- const parameters = getOperationParameters(op.httpOperation);
87
+ const parameters = getOperationParameters(op.httpOperation, ay.refkey());
88
88
  const args = parameters.flatMap(p => p.refkey);
89
89
  const isPaging = Boolean($.operation.getPagingMetadata(op.httpOperation.operation));
90
90
  return _$createComponent(ClassMethod, {
@@ -143,7 +143,7 @@ function ClientConstructor(props) {
143
143
  const subClients = props.client.subClients.filter(sc => $.client.haveSameConstructor(sc, props.client));
144
144
  const clientContextFieldRef = getClientContextFieldRef(props.client);
145
145
  const clientContextFactoryRef = getClientContextFactoryRef(props.client);
146
- const constructorParameters = buildClientParameters(props.client);
146
+ const constructorParameters = buildClientParameters(props.client, ay.refkey());
147
147
  const args = Object.values(constructorParameters).map(p => p.refkey);
148
148
  return _$createComponent(ts.ClassMethod, {
149
149
  name: "constructor",
@@ -169,7 +169,7 @@ function ClientConstructor(props) {
169
169
  });
170
170
  }
171
171
  function calculateSubClientArgs(subClient, parentParams) {
172
- const subClientParams = buildClientParameters(subClient).map(p => p.name);
172
+ const subClientParams = buildClientParameters(subClient, ay.refkey()).map(p => p.name);
173
173
  return parentParams.filter(({
174
174
  name
175
175
  }) => subClientParams.includes(name)).flatMap(p => p.refkey ? p.refkey : []);
@@ -1,4 +1,4 @@
1
- export declare const httpRuntimeTemplateLib: {} & {
1
+ export declare const httpRuntimeTemplateLib: {
2
2
  Client: import("@alloy-js/core").Refkey;
3
3
  ClientOptions: import("@alloy-js/core").Refkey;
4
4
  getClient: import("@alloy-js/core").Refkey;
@@ -15,5 +15,5 @@ export declare const httpRuntimeTemplateLib: {} & {
15
15
  HttpResponse: import("@alloy-js/core").Refkey;
16
16
  RawHttpHeaders: import("@alloy-js/core").Refkey;
17
17
  RestError: import("@alloy-js/core").Refkey;
18
- } & import("@alloy-js/core").SymbolCreator;
18
+ } & {} & {} & import("@alloy-js/core").SymbolCreator;
19
19
  //# sourceMappingURL=ts-http-runtime.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ts-http-runtime.d.ts","sourceRoot":"","sources":["../../../../src/components/external-packages/ts-http-runtime.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;0CAyBjC,CAAC"}
1
+ {"version":3,"file":"ts-http-runtime.d.ts","sourceRoot":"","sources":["../../../../src/components/external-packages/ts-http-runtime.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;oDAyBjC,CAAC"}
@@ -1,4 +1,4 @@
1
- export declare const uriTemplateLib: {} & {
1
+ export declare const uriTemplateLib: {
2
2
  parse: import("@alloy-js/core").Refkey;
3
- } & import("@alloy-js/core").SymbolCreator;
3
+ } & {} & {} & import("@alloy-js/core").SymbolCreator;
4
4
  //# sourceMappingURL=uri-template.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"uri-template.d.ts","sourceRoot":"","sources":["../../../../src/components/external-packages/uri-template.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,cAAc;;0CAQzB,CAAC"}
1
+ {"version":3,"file":"uri-template.d.ts","sourceRoot":"","sources":["../../../../src/components/external-packages/uri-template.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,cAAc;;oDAQzB,CAAC"}
@@ -2,7 +2,8 @@ import { Children, Refkey } from "@alloy-js/core";
2
2
  import { HttpOperation } from "@typespec/http";
3
3
  export interface HttpRequestOptionsProps {
4
4
  httpOperation: HttpOperation;
5
- refkey?: Refkey;
5
+ requestOptionsParamRefkey: Refkey;
6
+ requestOptionsVarRefkey: Refkey;
6
7
  children?: Children;
7
8
  }
8
9
  export declare function HttpRequestOptions(props: HttpRequestOptionsProps): Children;
@@ -12,6 +13,7 @@ export declare namespace HttpRequestOptions {
12
13
  }
13
14
  export interface HttpRequestOptionsHeadersProps {
14
15
  httpOperation: HttpOperation;
16
+ requestOptionsParamRefkey: Refkey;
15
17
  children?: Children;
16
18
  }
17
19
  export interface HttpRequestOptionsBodyProps {
@@ -1 +1 @@
1
- {"version":3,"file":"http-request-options.d.ts","sourceRoot":"","sources":["../../../src/components/http-request-options.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAQ,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAExD,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAM/C,MAAM,WAAW,uBAAuB;IACtC,aAAa,EAAE,aAAa,CAAC;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,uBAAuB,YAShE;yBATe,kBAAkB;yBAiBzB,8BAA8B;sBA6B0B,2BAA2B;;AAnC5F,MAAM,WAAW,8BAA8B;IAC7C,aAAa,EAAE,aAAa,CAAC;IAC7B,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB;AA0BD,MAAM,WAAW,2BAA2B;IAC1C,aAAa,EAAE,aAAa,CAAC;IAC7B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB;AAsBD,wBAAgB,cAAc,CAAC,KAAK,EAAE;IAAE,QAAQ,CAAC,EAAE,QAAQ,CAAA;CAAE,YAE5D"}
1
+ {"version":3,"file":"http-request-options.d.ts","sourceRoot":"","sources":["../../../src/components/http-request-options.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAQ,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAExD,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAK/C,MAAM,WAAW,uBAAuB;IACtC,aAAa,EAAE,aAAa,CAAC;IAC7B,yBAAyB,EAAE,MAAM,CAAC;IAClC,uBAAuB,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,uBAAuB,YAYhE;yBAZe,kBAAkB;yBAqBzB,8BAA8B;sBA6B0B,2BAA2B;;AApC5F,MAAM,WAAW,8BAA8B;IAC7C,aAAa,EAAE,aAAa,CAAC;IAC7B,yBAAyB,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB;AA0BD,MAAM,WAAW,2BAA2B;IAC1C,aAAa,EAAE,aAAa,CAAC;IAC7B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB;AAsBD,wBAAgB,cAAc,CAAC,KAAK,EAAE;IAAE,QAAQ,CAAC,EAAE,QAAQ,CAAA;CAAE,YAE5D"}
@@ -3,13 +3,12 @@ import { code } from "@alloy-js/core";
3
3
  import * as ts from "@alloy-js/typescript";
4
4
  import { EncodingProvider } from "./encoding-provider.js";
5
5
  import { HttpRequestParametersExpression } from "./http-request-parameters-expression.js";
6
- import { getOperationOptionsParameterRefkey } from "./operation-parameters.js";
7
6
  import { OperationTransformExpression } from "./transforms/operation-transform-expression.js";
8
7
  export function HttpRequestOptions(props) {
9
8
  return _$createComponent(ts.VarDeclaration, {
10
9
  name: "httpRequestOptions",
11
10
  get refkey() {
12
- return props.refkey;
11
+ return props.requestOptionsVarRefkey;
13
12
  },
14
13
  get children() {
15
14
  return _$createComponent(ts.ObjectExpression, {
@@ -17,6 +16,9 @@ export function HttpRequestOptions(props) {
17
16
  return [_$createComponent(HttpRequestOptions.Headers, {
18
17
  get httpOperation() {
19
18
  return props.httpOperation;
19
+ },
20
+ get requestOptionsParamRefkey() {
21
+ return props.requestOptionsParamRefkey;
20
22
  }
21
23
  }), _$createComponent(HttpRequestOptions.Body, {
22
24
  get httpOperation() {
@@ -32,7 +34,7 @@ HttpRequestOptions.Headers = function HttpRequestOptionsHeaders(props) {
32
34
  // Extract the header request parameters from the operation
33
35
  const httpOperation = props.httpOperation;
34
36
  const headers = props.httpOperation.parameters.properties.filter(p => p.kind === "header" || p.kind === "contentType");
35
- const optionsParam = getOperationOptionsParameterRefkey(props.httpOperation);
37
+ const optionsParam = props.requestOptionsParamRefkey;
36
38
  return _$createComponent(EncodingProvider, {
37
39
  defaults: {
38
40
  bytes: "base64",
@@ -2,6 +2,7 @@ import { Children, Refkey } from "@alloy-js/core";
2
2
  import { HttpOperation } from "@typespec/http";
3
3
  export interface HttpRequestProps {
4
4
  httpOperation: HttpOperation;
5
+ operationOptionsParamRefkey: Refkey;
5
6
  responseRefkey?: Refkey;
6
7
  }
7
8
  export declare function HttpRequest(props: HttpRequestProps): Children;
@@ -10,7 +11,8 @@ export declare namespace HttpRequest {
10
11
  }
11
12
  export interface HttpUrlProps {
12
13
  httpOperation: HttpOperation;
13
- refkey?: Refkey;
14
+ requestOptionsParamRefkey: Refkey;
15
+ pathVarRefkey?: Refkey;
14
16
  children?: Children;
15
17
  }
16
18
  //# sourceMappingURL=http-request.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"http-request.d.ts","sourceRoot":"","sources":["../../../src/components/http-request.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAsB,MAAM,EAAiB,MAAM,gBAAgB,CAAC;AAGrF,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAO/C,MAAM,WAAW,gBAAgB;IAC/B,aAAa,EAAE,aAAa,CAAC;IAC7B,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,YAyBlD;yBAzBe,WAAW;qBAiC0B,YAAY;;AANjE,MAAM,WAAW,YAAY;IAC3B,aAAa,EAAE,aAAa,CAAC;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB"}
1
+ {"version":3,"file":"http-request.d.ts","sourceRoot":"","sources":["../../../src/components/http-request.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAsB,MAAM,EAAiB,MAAM,gBAAgB,CAAC;AAGrF,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAM/C,MAAM,WAAW,gBAAgB;IAC/B,aAAa,EAAE,aAAa,CAAC;IAC7B,2BAA2B,EAAE,MAAM,CAAC;IACpC,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,YAiClD;yBAjCe,WAAW;qBA0C0B,YAAY;;AAPjE,MAAM,WAAW,YAAY;IAC3B,aAAa,EAAE,aAAa,CAAC;IAC7B,yBAAyB,EAAE,MAAM,CAAC;IAClC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB"}
@@ -6,10 +6,9 @@ import { EncodingProvider } from "./encoding-provider.js";
6
6
  import { uriTemplateLib } from "./external-packages/uri-template.js";
7
7
  import { HttpRequestOptions } from "./http-request-options.js";
8
8
  import { HttpRequestParametersExpression } from "./http-request-parameters-expression.js";
9
- import { getOperationOptionsParameterRefkey } from "./operation-parameters.js";
10
9
  export function HttpRequest(props) {
11
10
  const operationUrlRefkey = refkey();
12
- const requestOptionsRefkey = refkey();
11
+ const requestOptionsVarRefkey = refkey();
13
12
  const httpResponseRefkey = props.responseRefkey ?? refkey();
14
13
  const verb = props.httpOperation.verb;
15
14
  return _$createComponent(List, {
@@ -20,12 +19,18 @@ export function HttpRequest(props) {
20
19
  get httpOperation() {
21
20
  return props.httpOperation;
22
21
  },
23
- refkey: operationUrlRefkey
22
+ pathVarRefkey: operationUrlRefkey,
23
+ get requestOptionsParamRefkey() {
24
+ return props.operationOptionsParamRefkey;
25
+ }
24
26
  }), _$createComponent(HttpRequestOptions, {
25
27
  get httpOperation() {
26
28
  return props.httpOperation;
27
29
  },
28
- refkey: requestOptionsRefkey
30
+ get requestOptionsParamRefkey() {
31
+ return props.operationOptionsParamRefkey;
32
+ },
33
+ requestOptionsVarRefkey: requestOptionsVarRefkey
29
34
  }), _$createComponent(ts.VarDeclaration, {
30
35
  name: "response",
31
36
  refkey: httpResponseRefkey,
@@ -34,7 +39,7 @@ export function HttpRequest(props) {
34
39
  await client.pathUnchecked(${_$createComponent(Reference, {
35
40
  refkey: operationUrlRefkey
36
41
  })}).${verb}(${_$createComponent(Reference, {
37
- refkey: requestOptionsRefkey
42
+ refkey: requestOptionsVarRefkey
38
43
  })})
39
44
  `;
40
45
  }
@@ -50,7 +55,6 @@ export function HttpRequest(props) {
50
55
  HttpRequest.Url = function HttpUrlDeclaration(props) {
51
56
  const urlTemplate = props.httpOperation.uriTemplate;
52
57
  const urlParameters = props.httpOperation.parameters.properties.filter(p => p.kind === "path" || p.kind === "query");
53
- const optionsParameter = getOperationOptionsParameterRefkey(props.httpOperation);
54
58
  return _$createComponent(EncodingProvider, {
55
59
  defaults: {
56
60
  bytes: "base64url"
@@ -59,14 +63,16 @@ HttpRequest.Url = function HttpUrlDeclaration(props) {
59
63
  return _$createComponent(ts.VarDeclaration, {
60
64
  name: "path",
61
65
  get refkey() {
62
- return props.refkey;
66
+ return props.pathVarRefkey;
63
67
  },
64
68
  get children() {
65
69
  return [_$memo(() => uriTemplateLib.parse), "(", _$memo(() => JSON.stringify(urlTemplate)), ").expand(", _$memo(() => _$createComponent(HttpRequestParametersExpression, {
66
70
  get httpOperation() {
67
71
  return props.httpOperation;
68
72
  },
69
- optionsParameter: optionsParameter,
73
+ get optionsParameter() {
74
+ return props.requestOptionsParamRefkey;
75
+ },
70
76
  parameters: urlParameters
71
77
  })), ")"];
72
78
  }
@@ -1 +1 @@
1
- {"version":3,"file":"paginated-operation-handler.d.ts","sourceRoot":"","sources":["../../../../../src/components/operation-handlers/paging/paginated-operation-handler.tsx"],"names":[],"mappings":"AA4BA,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,eAAO,MAAM,yBAAyB,EAAE,gBA6DvC,CAAC"}
1
+ {"version":3,"file":"paginated-operation-handler.d.ts","sourceRoot":"","sources":["../../../../../src/components/operation-handlers/paging/paginated-operation-handler.tsx"],"names":[],"mappings":"AA4BA,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,eAAO,MAAM,yBAAyB,EAAE,gBAkEvC,CAAC"}
@@ -41,11 +41,12 @@ export const PaginatedOperationHandler = {
41
41
  const operationRefkey = ay.refkey(httpOperation.operation);
42
42
  const returnType = ay.code`${getPagedAsyncIterableIteratorRefkey()}<${getPageItemTypeName(pagingOperation)},${getPageResponseTypeRefkey(httpOperation)},${getPageSettingsTypeRefkey(httpOperation)}>`;
43
43
  const clientContextInterfaceRef = getClientcontextDeclarationRef(client);
44
+ const optionsRefkey = ay.refkey();
44
45
  const signatureParams = [{
45
46
  name: "client",
46
47
  type: clientContextInterfaceRef,
47
- refkey: ay.refkey(client, "client")
48
- }, ...getOperationParameters(httpOperation)];
48
+ refkey: ay.refkey(client, "paging-operation-client-param")
49
+ }, ...getOperationParameters(httpOperation, optionsRefkey)];
49
50
  const pagingDetail = extractPagingDetail(httpOperation, pagingOperation);
50
51
  // Exclude from operation options and include them into PageSettings
51
52
  const excludes = getPageSettingProperties(pagingOperation).map(p => p.property);
@@ -1 +1 @@
1
- {"version":3,"file":"request-send.d.ts","sourceRoot":"","sources":["../../../../../src/components/operation-handlers/paging/request-send.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACrC,OAAO,EAAQ,MAAM,EAA+B,MAAM,gBAAgB,CAAC;AAC3E,OAAO,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAG3C,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAU/C,MAAM,WAAW,oBAAoB;IACnC,aAAa,EAAE,aAAa,CAAC;IAC7B,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,wBAAgB,wBAAwB,CAAC,aAAa,EAAE,aAAa,aAEpE;AAED,wBAAgB,wBAAwB,CAAC,aAAa,EAAE,aAAa,4BAiBpE;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,oBAAoB,eA0B1D"}
1
+ {"version":3,"file":"request-send.d.ts","sourceRoot":"","sources":["../../../../../src/components/operation-handlers/paging/request-send.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACrC,OAAO,EAAQ,MAAM,EAA+B,MAAM,gBAAgB,CAAC;AAC3E,OAAO,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAG3C,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAO/C,MAAM,WAAW,oBAAoB;IACnC,aAAa,EAAE,aAAa,CAAC;IAC7B,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,wBAAgB,wBAAwB,CAAC,aAAa,EAAE,aAAa,aAEpE;AAMD,wBAAgB,wBAAwB,CAAC,aAAa,EAAE,aAAa,4BAsBpE;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,oBAAoB,eAmC1D"}
@@ -8,33 +8,38 @@ import * as cl from "@typespec/http-client";
8
8
  import { getClientcontextDeclarationRef } from "../../client-context/client-context-declaration.js";
9
9
  import { HttpRequestOptions } from "../../http-request-options.js";
10
10
  import { HttpRequest } from "../../http-request.js";
11
- import { getOperationOptionsParameterRefkey, getOperationParameters } from "../../operation-parameters.js";
11
+ import { getOperationParameters } from "../../operation-parameters.js";
12
12
  export function getHttpRequestSendRefkey(httpOperation) {
13
13
  return refkey(httpOperation, "http-request-send");
14
14
  }
15
+ function getPagingOperationOptionsParameterRefkey(httpOperation) {
16
+ return refkey(httpOperation, "paging-operation-options-parameter");
17
+ }
15
18
  export function getHttpRequestSendParams(httpOperation) {
19
+ const optionsRefkey = getPagingOperationOptionsParameterRefkey(httpOperation);
16
20
  const clientLibrary = cl.useClientLibrary();
17
21
  const client = clientLibrary.getClientForOperation(httpOperation);
18
22
  const clientContextInterfaceRef = getClientcontextDeclarationRef(client);
19
23
  const signatureParams = [{
20
24
  name: "client",
21
25
  type: clientContextInterfaceRef,
22
- refkey: ay.refkey(client, "client")
23
- }, ...getOperationParameters(httpOperation)];
26
+ refkey: ay.refkey(client, "send-client-param")
27
+ }, ...getOperationParameters(httpOperation, optionsRefkey)];
24
28
  const parameters = [...signatureParams];
25
29
  // re-correct the `options` parameter to Record<string, any> to accept both paging and non-paging options
26
30
  parameters[parameters.length - 1] = {
27
31
  name: "options",
28
32
  type: "Record<string, any>",
29
- refkey: getOperationOptionsParameterRefkey(httpOperation),
33
+ refkey: optionsRefkey,
30
34
  optional: true
31
35
  };
32
36
  return parameters;
33
37
  }
34
38
  export function HttpRequestSend(props) {
35
39
  const httpOperation = props.httpOperation;
40
+ const optionsRefkey = getPagingOperationOptionsParameterRefkey(httpOperation);
36
41
  const operationUrlRefkey = refkey();
37
- const requestOptionsRefkey = refkey();
42
+ const requestOptionsVarRefkey = refkey();
38
43
  const verb = props.httpOperation.verb;
39
44
  const namePolicy = ts.useTSNamePolicy();
40
45
  const functionName = namePolicy.getName(httpOperation.operation.name + "Send", "function");
@@ -56,16 +61,18 @@ export function HttpRequestSend(props) {
56
61
  get httpOperation() {
57
62
  return props.httpOperation;
58
63
  },
59
- refkey: operationUrlRefkey
64
+ pathVarRefkey: operationUrlRefkey,
65
+ requestOptionsParamRefkey: optionsRefkey
60
66
  }), _$createComponent(HttpRequestOptions, {
61
67
  get httpOperation() {
62
68
  return props.httpOperation;
63
69
  },
64
- refkey: requestOptionsRefkey
70
+ requestOptionsVarRefkey: requestOptionsVarRefkey,
71
+ requestOptionsParamRefkey: optionsRefkey
65
72
  }), _$memo(() => code`return await client.pathUnchecked(${_$createComponent(Reference, {
66
73
  refkey: operationUrlRefkey
67
74
  })}).${verb}(${_$createComponent(Reference, {
68
- refkey: requestOptionsRefkey
75
+ refkey: requestOptionsVarRefkey
69
76
  })});`)];
70
77
  }
71
78
  });
@@ -7,5 +7,6 @@ export interface HttpResponseDeserializeProps {
7
7
  responseRefkey: Refkey;
8
8
  children?: Children;
9
9
  }
10
+ export declare function getPagingDeserializationOptionsParamRef(httpOperation: HttpOperation): Refkey;
10
11
  export declare function HttpResponseDeserialize(props: HttpResponseProps): Children;
11
12
  //# sourceMappingURL=response-deserialize.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"response-deserialize.d.ts","sourceRoot":"","sources":["../../../../../src/components/operation-handlers/paging/response-deserialize.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAc,MAAM,EAAU,MAAM,gBAAgB,CAAC;AAGtE,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE/C,OAAO,EAAE,iBAAiB,EAAiB,MAAM,yBAAyB,CAAC;AAK3E,wBAAgB,+BAA+B,CAAC,aAAa,EAAE,aAAa,UAE3E;AAED,MAAM,WAAW,4BAA4B;IAC3C,aAAa,EAAE,aAAa,CAAC;IAC7B,cAAc,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB;AAED,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,iBAAiB,YAiC/D"}
1
+ {"version":3,"file":"response-deserialize.d.ts","sourceRoot":"","sources":["../../../../../src/components/operation-handlers/paging/response-deserialize.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAc,MAAM,EAAU,MAAM,gBAAgB,CAAC;AAGtE,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE/C,OAAO,EAAE,iBAAiB,EAAiB,MAAM,yBAAyB,CAAC;AAI3E,wBAAgB,+BAA+B,CAAC,aAAa,EAAE,aAAa,UAE3E;AAED,MAAM,WAAW,4BAA4B;IAC3C,aAAa,EAAE,aAAa,CAAC;IAC7B,cAAc,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB;AAED,wBAAgB,uCAAuC,CAAC,aAAa,EAAE,aAAa,GAAG,MAAM,CAE5F;AAED,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,iBAAiB,YAkC/D"}
@@ -5,13 +5,16 @@ import { FunctionDeclaration } from "@typespec/emitter-framework/typescript";
5
5
  import { httpRuntimeTemplateLib } from "../../external-packages/ts-http-runtime.js";
6
6
  import { HttpResponses } from "../../http-response.js";
7
7
  import { getOperationOptionsTypeRefkey } from "../../operation-options.js";
8
- import { getOperationOptionsParameterRefkey } from "../../operation-parameters.js";
9
8
  import { getCreateRestErrorRefkey } from "../../static-helpers/rest-error.js";
10
9
  export function getHttpRequestDeserializeRefkey(httpOperation) {
11
10
  return refkey(httpOperation, "http-request-deserialize");
12
11
  }
12
+ export function getPagingDeserializationOptionsParamRef(httpOperation) {
13
+ return refkey(httpOperation, "paging-deserialization-options-parameter");
14
+ }
13
15
  export function HttpResponseDeserialize(props) {
14
16
  const httpOperation = props.httpOperation;
17
+ const httpRequestOptionsRefkey = getPagingDeserializationOptionsParamRef(httpOperation);
15
18
  const namePolicy = ts.useTSNamePolicy();
16
19
  const functionName = namePolicy.getName(httpOperation.operation.name + "Deserialize", "function");
17
20
  const params = [{
@@ -19,7 +22,7 @@ export function HttpResponseDeserialize(props) {
19
22
  type: httpRuntimeTemplateLib.PathUncheckedResponse
20
23
  }, {
21
24
  name: "options",
22
- refkey: getOperationOptionsParameterRefkey(httpOperation),
25
+ refkey: httpRequestOptionsRefkey,
23
26
  type: getOperationOptionsTypeRefkey(httpOperation),
24
27
  optional: true
25
28
  }];
@@ -4,6 +4,5 @@ import { HttpOperation } from "@typespec/http";
4
4
  export interface OperationParametersProps {
5
5
  operation: HttpOperation;
6
6
  }
7
- export declare function getOperationOptionsParameterRefkey(operation: HttpOperation): ay.Refkey;
8
- export declare function getOperationParameters(operation: HttpOperation): ts.ParameterDescriptor[];
7
+ export declare function getOperationParameters(operation: HttpOperation, optionsRefkey: ay.Refkey): ts.ParameterDescriptor[];
9
8
  //# sourceMappingURL=operation-parameters.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"operation-parameters.d.ts","sourceRoot":"","sources":["../../../src/components/operation-parameters.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACrC,OAAO,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAG3C,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAI/C,MAAM,WAAW,wBAAwB;IACvC,SAAS,EAAE,aAAa,CAAC;CAC1B;AAED,wBAAgB,kCAAkC,CAAC,SAAS,EAAE,aAAa,aAE1E;AAED,wBAAgB,sBAAsB,CAAC,SAAS,EAAE,aAAa,GAAG,EAAE,CAAC,mBAAmB,EAAE,CA2BzF"}
1
+ {"version":3,"file":"operation-parameters.d.ts","sourceRoot":"","sources":["../../../src/components/operation-parameters.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACrC,OAAO,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAG3C,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAI/C,MAAM,WAAW,wBAAwB;IACvC,SAAS,EAAE,aAAa,CAAC;CAC1B;AAED,wBAAgB,sBAAsB,CACpC,SAAS,EAAE,aAAa,EACxB,aAAa,EAAE,EAAE,CAAC,MAAM,GACvB,EAAE,CAAC,mBAAmB,EAAE,CA2B1B"}
@@ -4,10 +4,7 @@ import { useTransformNamePolicy } from "@typespec/emitter-framework";
4
4
  import * as ef from "@typespec/emitter-framework/typescript";
5
5
  import { hasDefaultValue } from "../utils/parameters.js";
6
6
  import { getOperationOptionsTypeRefkey } from "./operation-options.js";
7
- export function getOperationOptionsParameterRefkey(operation) {
8
- return ay.refkey(operation, "operation-options-parameter");
9
- }
10
- export function getOperationParameters(operation) {
7
+ export function getOperationParameters(operation, optionsRefkey) {
11
8
  const transformNamer = useTransformNamePolicy();
12
9
  const requiredParameters = operation.parameters.properties.filter(p => !p.property.optional && !hasDefaultValue(p)).filter(p => p.path.length === 1);
13
10
  const parameters = [];
@@ -15,7 +12,7 @@ export function getOperationParameters(operation) {
15
12
  const name = transformNamer.getApplicationName(parameter.property);
16
13
  const parameterDescriptor = {
17
14
  name,
18
- refkey: ay.refkey(parameter.property, "operation-parameter"),
15
+ refkey: ay.refkey(),
19
16
  type: _$createComponent(ef.TypeExpression, {
20
17
  get type() {
21
18
  return parameter.property.type;
@@ -26,7 +23,7 @@ export function getOperationParameters(operation) {
26
23
  }
27
24
  parameters.push({
28
25
  name: "options",
29
- refkey: getOperationOptionsParameterRefkey(operation),
26
+ refkey: optionsRefkey,
30
27
  type: getOperationOptionsTypeRefkey(operation),
31
28
  optional: true
32
29
  });
@@ -5,7 +5,7 @@ export interface TransformDeclarationProps {
5
5
  operation: ClientOperation;
6
6
  refkey?: ay.Refkey;
7
7
  }
8
- export declare function getTransformDeclarationRef(operaion: ClientOperation): ay.Refkey;
8
+ export declare function getTransformDeclarationRef(operation: ClientOperation): ay.Refkey;
9
9
  export declare function TransformDeclaration(props: TransformDeclarationProps): ay.Children;
10
10
  export interface SingleBodyTransformDeclarationProps {
11
11
  name: string;
@@ -1 +1 @@
1
- {"version":3,"file":"operation-transform-declaration.d.ts","sourceRoot":"","sources":["../../../../src/components/transforms/operation-transform-declaration.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAGrC,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD,MAAM,WAAW,yBAAyB;IACxC,SAAS,EAAE,eAAe,CAAC;IAC3B,MAAM,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC;CACpB;AAED,wBAAgB,0BAA0B,CAAC,QAAQ,EAAE,eAAe,aAKnE;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,yBAAyB,eAOpE;AAED,MAAM,WAAW,mCAAmC;IAClD,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,eAAe,CAAC;IAC3B,OAAO,EAAE,iBAAiB,CAAC;IAC3B,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC;CACnB;AAED,wBAAgB,8BAA8B,CAAC,KAAK,EAAE,mCAAmC,eAmBxF"}
1
+ {"version":3,"file":"operation-transform-declaration.d.ts","sourceRoot":"","sources":["../../../../src/components/transforms/operation-transform-declaration.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAGrC,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD,MAAM,WAAW,yBAAyB;IACxC,SAAS,EAAE,eAAe,CAAC;IAC3B,MAAM,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC;CACpB;AAED,wBAAgB,0BAA0B,CAAC,SAAS,EAAE,eAAe,aAEpE;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,yBAAyB,eAOpE;AAED,MAAM,WAAW,mCAAmC;IAClD,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,eAAe,CAAC;IAC3B,OAAO,EAAE,iBAAiB,CAAC;IAC3B,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC;CACnB;AAED,wBAAgB,8BAA8B,CAAC,KAAK,EAAE,mCAAmC,eAmBxF"}
@@ -3,11 +3,8 @@ import * as ay from "@alloy-js/core";
3
3
  import * as ts from "@alloy-js/typescript";
4
4
  import * as ef from "@typespec/emitter-framework/typescript";
5
5
  import { JsonTransform } from "./json/json-transform.js";
6
- export function getTransformDeclarationRef(operaion) {
7
- if (operaion.httpOperation.parameters.body?.bodyKind === "single") {
8
- return ef.getTypeTransformerRefkey(operaion.httpOperation.parameters.body.type, "transport");
9
- }
10
- return ay.refkey(operaion, "transform");
6
+ export function getTransformDeclarationRef(operation) {
7
+ return ay.refkey(operation, "transform");
11
8
  }
12
9
  export function TransformDeclaration(props) {
13
10
  const refkey = props.refkey ?? getTransformDeclarationRef(props.operation);
@@ -1,8 +1,9 @@
1
+ import * as ay from "@alloy-js/core";
1
2
  import * as ts from "@alloy-js/typescript";
2
3
  import { ModelProperty } from "@typespec/compiler";
3
4
  import { HttpProperty } from "@typespec/http";
4
5
  import * as cl from "@typespec/http-client";
5
- export declare function buildClientParameters(client: cl.Client): ts.ParameterDescriptor[];
6
+ export declare function buildClientParameters(client: cl.Client, suffixRefkey: ay.Refkey): ts.ParameterDescriptor[];
6
7
  /**
7
8
  * Checks if a parameter has a default value. Only honors default values for content-type.
8
9
  * @param property Property to check
@@ -1 +1 @@
1
- {"version":3,"file":"parameters.d.ts","sourceRoot":"","sources":["../../../src/utils/parameters.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAS,MAAM,oBAAoB,CAAC;AAG1D,OAAO,EAAY,YAAY,EAAkB,MAAM,gBAAgB,CAAC;AACxE,OAAO,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAI5C,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,GAAG,EAAE,CAAC,mBAAmB,EAAE,CA8BjF;AA4DD;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,YAAY,GAAG,OAAO,CAE/D;AAED,wBAAgB,eAAe,CAAC,QAAQ,EAAE,aAAa,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;AAChG,wBAAgB,eAAe,CAAC,QAAQ,EAAE,YAAY,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC"}
1
+ {"version":3,"file":"parameters.d.ts","sourceRoot":"","sources":["../../../src/utils/parameters.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACrC,OAAO,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAS,MAAM,oBAAoB,CAAC;AAG1D,OAAO,EAAY,YAAY,EAAkB,MAAM,gBAAgB,CAAC;AACxE,OAAO,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAI5C,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,EAAE,CAAC,MAAM,EACjB,YAAY,EAAE,EAAE,CAAC,MAAM,GACtB,EAAE,CAAC,mBAAmB,EAAE,CA8B1B;AA6DD;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,YAAY,GAAG,OAAO,CAE/D;AAED,wBAAgB,eAAe,CAAC,QAAQ,EAAE,aAAa,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;AAChG,wBAAgB,eAAe,CAAC,QAAQ,EAAE,YAAY,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC"}
@@ -3,14 +3,14 @@ import { useTsp } from "@typespec/emitter-framework";
3
3
  import { buildParameterDescriptor } from "@typespec/emitter-framework/typescript";
4
4
  import { getClientContextOptionsRef } from "../components/client-context/client-context-options.js";
5
5
  import { httpRuntimeTemplateLib } from "../components/external-packages/ts-http-runtime.js";
6
- export function buildClientParameters(client) {
6
+ export function buildClientParameters(client, suffixRefkey) {
7
7
  const {
8
8
  $
9
9
  } = useTsp();
10
10
  const clientConstructor = $.client.getConstructor(client);
11
11
  const parameters = $.operation.getClientSignature(client, clientConstructor);
12
12
  const params = parameters.flatMap(param => {
13
- const descriptor = buildClientParameterDescriptor(param);
13
+ const descriptor = buildClientParameterDescriptor(param, suffixRefkey);
14
14
  if (!descriptor) {
15
15
  return [];
16
16
  }
@@ -22,14 +22,14 @@ export function buildClientParameters(client) {
22
22
  if (!params.some(p => p.name === "options")) {
23
23
  params.push({
24
24
  name: "options",
25
- refkey: ay.refkey(),
25
+ refkey: ay.refkey("client-options", suffixRefkey),
26
26
  optional: true,
27
27
  type: getClientContextOptionsRef(client)
28
28
  });
29
29
  }
30
30
  return params;
31
31
  }
32
- function buildClientParameterDescriptor(modelProperty) {
32
+ function buildClientParameterDescriptor(modelProperty, suffixRefkey) {
33
33
  const {
34
34
  $
35
35
  } = useTsp();
@@ -41,14 +41,14 @@ function buildClientParameterDescriptor(modelProperty) {
41
41
  const credentialType = Array.from(new Set(authSchemes.filter(s => s.type !== "noAuth").map(s => getCredentialType(s))));
42
42
  return {
43
43
  name: "credential",
44
- refkey: ay.refkey(modelProperty),
44
+ refkey: ay.refkey(modelProperty, suffixRefkey),
45
45
  optional: modelProperty.optional,
46
46
  type: ay.mapJoin(() => credentialType, t => t, {
47
47
  joiner: " | "
48
48
  })
49
49
  };
50
50
  }
51
- return buildParameterDescriptor(modelProperty);
51
+ return buildParameterDescriptor(modelProperty, suffixRefkey);
52
52
  }
53
53
  const oauth2FlowRefs = {
54
54
  authorizationCode: httpRuntimeTemplateLib.AuthorizationCodeFlow,