@typespec/http-client-js 0.7.0-dev.1 → 0.7.0-dev.3
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.
- package/dist/src/components/client-context/client-context-declaration.d.ts +2 -3
- package/dist/src/components/client-context/client-context-declaration.d.ts.map +1 -1
- package/dist/src/components/client-context/client-context-declaration.js +2 -2
- package/dist/src/components/client-context/client-context-factory.d.ts +3 -3
- package/dist/src/components/client-context/client-context-factory.d.ts.map +1 -1
- package/dist/src/components/client-context/client-context-factory.js +10 -10
- package/dist/src/components/client-context/client-context-options.d.ts +3 -3
- package/dist/src/components/client-context/client-context-options.d.ts.map +1 -1
- package/dist/src/components/client-context/client-context-options.js +3 -3
- package/dist/src/components/client-context/client-context.d.ts +3 -3
- package/dist/src/components/client-context/client-context.d.ts.map +1 -1
- package/dist/src/components/client-context/parametrized-endpoint.d.ts +3 -3
- package/dist/src/components/client-context/parametrized-endpoint.d.ts.map +1 -1
- package/dist/src/components/client-context/parametrized-endpoint.js +5 -5
- package/dist/src/components/client-directory.d.ts +4 -4
- package/dist/src/components/client-directory.d.ts.map +1 -1
- package/dist/src/components/client-directory.js +5 -5
- package/dist/src/components/client-operation.d.ts +4 -4
- package/dist/src/components/client-operation.d.ts.map +1 -1
- package/dist/src/components/client-operation.js +6 -6
- package/dist/src/components/client.d.ts +5 -5
- package/dist/src/components/client.d.ts.map +1 -1
- package/dist/src/components/client.js +14 -14
- package/dist/src/components/encoding-provider.d.ts +1 -1
- package/dist/src/components/encoding-provider.d.ts.map +1 -1
- package/dist/src/components/http-request-parameters-expression.d.ts +4 -4
- package/dist/src/components/http-request-parameters-expression.d.ts.map +1 -1
- package/dist/src/components/http-request-parameters-expression.js +10 -10
- package/dist/src/components/models.d.ts +1 -2
- package/dist/src/components/models.d.ts.map +1 -1
- package/dist/src/components/models.js +2 -3
- package/dist/src/components/operation-handlers/operation-pipeline.d.ts +1 -2
- package/dist/src/components/operation-handlers/operation-pipeline.d.ts.map +1 -1
- package/dist/src/components/operation-handlers/operation-pipeline.js +2 -2
- package/dist/src/components/operation-handlers/paging/page-response.d.ts +2 -3
- package/dist/src/components/operation-handlers/paging/page-response.d.ts.map +1 -1
- package/dist/src/components/operation-handlers/paging/page-response.js +3 -3
- package/dist/src/components/operation-handlers/paging/page-settings.d.ts +2 -3
- package/dist/src/components/operation-handlers/paging/page-settings.d.ts.map +1 -1
- package/dist/src/components/operation-handlers/paging/page-settings.js +3 -3
- package/dist/src/components/operation-handlers/paging/paginated-operation-handler.d.ts.map +1 -1
- package/dist/src/components/operation-handlers/paging/paginated-operation-handler.js +16 -16
- package/dist/src/components/operation-handlers/paging/request-send.d.ts +2 -3
- package/dist/src/components/operation-handlers/paging/request-send.d.ts.map +1 -1
- package/dist/src/components/operation-handlers/paging/request-send.js +1 -2
- package/dist/src/components/operation-handlers/types.d.ts +1 -1
- package/dist/src/components/operation-handlers/types.d.ts.map +1 -1
- package/dist/src/components/operation-options.d.ts +2 -3
- package/dist/src/components/operation-options.d.ts.map +1 -1
- package/dist/src/components/operation-options.js +3 -3
- package/dist/src/components/operation-parameters.d.ts +2 -2
- package/dist/src/components/operation-parameters.d.ts.map +1 -1
- package/dist/src/components/operation-parameters.js +2 -2
- package/dist/src/components/output.d.ts +3 -3
- package/dist/src/components/output.d.ts.map +1 -1
- package/dist/src/components/static-helpers/bytes-encoding.d.ts +6 -5
- package/dist/src/components/static-helpers/bytes-encoding.d.ts.map +1 -1
- package/dist/src/components/static-helpers/bytes-encoding.js +15 -19
- package/dist/src/components/static-helpers/interfaces.d.ts +3 -4
- package/dist/src/components/static-helpers/interfaces.d.ts.map +1 -1
- package/dist/src/components/static-helpers/interfaces.js +3 -3
- package/dist/src/components/static-helpers/multipart-helpers.d.ts +4 -5
- package/dist/src/components/static-helpers/multipart-helpers.d.ts.map +1 -1
- package/dist/src/components/static-helpers/multipart-helpers.js +8 -10
- package/dist/src/components/static-helpers/paging-helper.d.ts +3 -4
- package/dist/src/components/static-helpers/paging-helper.d.ts.map +1 -1
- package/dist/src/components/static-helpers/paging-helper.js +17 -23
- package/dist/src/components/static-helpers/rest-error.d.ts +3 -4
- package/dist/src/components/static-helpers/rest-error.d.ts.map +1 -1
- package/dist/src/components/static-helpers/rest-error.js +19 -25
- package/dist/src/components/testing/client-options.d.ts +3 -3
- package/dist/src/components/testing/client-options.d.ts.map +1 -1
- package/dist/src/components/testing/client-options.js +2 -2
- package/dist/src/components/transforms/content-type-encoding-provider.d.ts +1 -1
- package/dist/src/components/transforms/content-type-encoding-provider.d.ts.map +1 -1
- package/dist/src/components/transforms/json/json-array-transform.d.ts +6 -6
- package/dist/src/components/transforms/json/json-array-transform.d.ts.map +1 -1
- package/dist/src/components/transforms/json/json-array-transform.js +5 -5
- package/dist/src/components/transforms/json/json-model-additional-properties-transform.d.ts +4 -4
- package/dist/src/components/transforms/json/json-model-additional-properties-transform.d.ts.map +1 -1
- package/dist/src/components/transforms/json/json-model-additional-properties-transform.js +4 -4
- package/dist/src/components/transforms/json/json-model-base-transform.d.ts +4 -4
- package/dist/src/components/transforms/json/json-model-base-transform.d.ts.map +1 -1
- package/dist/src/components/transforms/json/json-model-property-transform.d.ts +3 -3
- package/dist/src/components/transforms/json/json-model-property-transform.d.ts.map +1 -1
- package/dist/src/components/transforms/json/json-model-property-transform.js +3 -3
- package/dist/src/components/transforms/json/json-model-transform.d.ts +6 -6
- package/dist/src/components/transforms/json/json-model-transform.d.ts.map +1 -1
- package/dist/src/components/transforms/json/json-model-transform.js +8 -8
- package/dist/src/components/transforms/json/json-record-transform.d.ts +6 -6
- package/dist/src/components/transforms/json/json-record-transform.d.ts.map +1 -1
- package/dist/src/components/transforms/json/json-record-transform.js +5 -5
- package/dist/src/components/transforms/json/json-transform-discriminator.d.ts +5 -5
- package/dist/src/components/transforms/json/json-transform-discriminator.d.ts.map +1 -1
- package/dist/src/components/transforms/json/json-transform-discriminator.js +13 -13
- package/dist/src/components/transforms/json/json-transform.d.ts +6 -5
- package/dist/src/components/transforms/json/json-transform.d.ts.map +1 -1
- package/dist/src/components/transforms/json/json-transform.js +2 -2
- package/dist/src/components/transforms/json/union-transform.d.ts +6 -6
- package/dist/src/components/transforms/json/union-transform.d.ts.map +1 -1
- package/dist/src/components/transforms/json/union-transform.js +6 -6
- package/dist/src/components/transforms/json/utils/transport-namer.d.ts +1 -1
- package/dist/src/components/transforms/json/utils/transport-namer.d.ts.map +1 -1
- package/dist/src/components/transforms/multipart/array-part-transform.d.ts +3 -3
- package/dist/src/components/transforms/multipart/array-part-transform.d.ts.map +1 -1
- package/dist/src/components/transforms/multipart/array-part-transform.js +5 -5
- package/dist/src/components/transforms/multipart/file-part-transform.d.ts +3 -3
- package/dist/src/components/transforms/multipart/file-part-transform.d.ts.map +1 -1
- package/dist/src/components/transforms/multipart/file-part-transform.js +2 -2
- package/dist/src/components/transforms/multipart/multipart-transform.d.ts +1 -2
- package/dist/src/components/transforms/multipart/multipart-transform.d.ts.map +1 -1
- package/dist/src/components/transforms/multipart/multipart-transform.js +2 -2
- package/dist/src/components/transforms/multipart/part-transform.d.ts +3 -3
- package/dist/src/components/transforms/multipart/part-transform.d.ts.map +1 -1
- package/dist/src/components/transforms/multipart/simple-part-transform.d.ts +3 -3
- package/dist/src/components/transforms/multipart/simple-part-transform.d.ts.map +1 -1
- package/dist/src/components/transforms/multipart/simple-part-transform.js +5 -5
- package/dist/src/components/transforms/operation-transform-declaration.d.ts +6 -6
- package/dist/src/components/transforms/operation-transform-declaration.d.ts.map +1 -1
- package/dist/src/components/transforms/operation-transform-declaration.js +3 -3
- package/dist/src/components/transforms/transform-name-policy.d.ts +1 -1
- package/dist/src/components/transforms/transform-name-policy.d.ts.map +1 -1
- package/dist/src/emitter.js +6 -6
- package/dist/src/utils/multipart.d.ts +1 -1
- package/dist/src/utils/multipart.d.ts.map +1 -1
- package/dist/src/utils/parameters.d.ts +2 -2
- package/dist/src/utils/parameters.d.ts.map +1 -1
- package/dist/src/utils/parameters.js +6 -6
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -4
- package/src/components/client-context/client-context-declaration.tsx +2 -2
- package/src/components/client-context/client-context-factory.tsx +19 -19
- package/src/components/client-context/client-context-options.tsx +5 -5
- package/src/components/client-context/client-context.tsx +2 -2
- package/src/components/client-context/parametrized-endpoint.tsx +8 -8
- package/src/components/client-directory.tsx +10 -10
- package/src/components/client-operation.tsx +11 -11
- package/src/components/client.tsx +21 -21
- package/src/components/encoding-provider.tsx +1 -1
- package/src/components/http-request-parameters-expression.tsx +19 -19
- package/src/components/models.tsx +2 -3
- package/src/components/operation-handlers/operation-pipeline.tsx +2 -2
- package/src/components/operation-handlers/paging/page-response.tsx +4 -4
- package/src/components/operation-handlers/paging/page-settings.tsx +4 -4
- package/src/components/operation-handlers/paging/paginated-operation-handler.tsx +18 -19
- package/src/components/operation-handlers/paging/request-send.tsx +1 -2
- package/src/components/operation-handlers/types.tsx +1 -1
- package/src/components/operation-options.tsx +4 -4
- package/src/components/operation-parameters.tsx +3 -3
- package/src/components/output.tsx +2 -2
- package/src/components/serializers.tsx +1 -1
- package/src/components/static-helpers/bytes-encoding.tsx +17 -16
- package/src/components/static-helpers/interfaces.tsx +3 -3
- package/src/components/static-helpers/multipart-helpers.tsx +7 -7
- package/src/components/static-helpers/paging-helper.tsx +17 -20
- package/src/components/static-helpers/rest-error.tsx +17 -17
- package/src/components/testing/client-options.tsx +3 -3
- package/src/components/transforms/content-type-encoding-provider.tsx +1 -1
- package/src/components/transforms/json/json-array-transform.tsx +8 -8
- package/src/components/transforms/json/json-model-additional-properties-transform.tsx +6 -6
- package/src/components/transforms/json/json-model-base-transform.tsx +3 -3
- package/src/components/transforms/json/json-model-property-transform.tsx +6 -6
- package/src/components/transforms/json/json-model-transform.tsx +12 -14
- package/src/components/transforms/json/json-record-transform.tsx +8 -8
- package/src/components/transforms/json/json-transform-discriminator.tsx +12 -12
- package/src/components/transforms/json/json-transform.tsx +6 -5
- package/src/components/transforms/json/union-transform.tsx +8 -8
- package/src/components/transforms/json/utils/transport-namer.ts +1 -1
- package/src/components/transforms/multipart/array-part-transform.tsx +6 -5
- package/src/components/transforms/multipart/file-part-transform.tsx +5 -5
- package/src/components/transforms/multipart/multipart-transform.tsx +3 -3
- package/src/components/transforms/multipart/part-transform.tsx +2 -2
- package/src/components/transforms/multipart/simple-part-transform.tsx +8 -8
- package/src/components/transforms/operation-transform-declaration.tsx +7 -6
- package/src/components/transforms/operation-transform-expression.tsx +1 -1
- package/src/components/transforms/transform-name-policy.ts +1 -1
- package/src/emitter.tsx +11 -11
- package/src/utils/multipart.ts +1 -1
- package/src/utils/parameters.tsx +9 -9
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import * as ay from "@alloy-js/core";
|
|
2
1
|
import * as cl from "@typespec/http-client";
|
|
3
2
|
export interface ClientContextDeclarationProps {
|
|
4
3
|
client: cl.Client;
|
|
5
4
|
}
|
|
6
|
-
export declare function getClientcontextDeclarationRef(client: cl.Client):
|
|
7
|
-
export declare function ClientContextDeclaration(props: ClientContextDeclarationProps):
|
|
5
|
+
export declare function getClientcontextDeclarationRef(client: cl.Client): import("@alloy-js/core").Refkey;
|
|
6
|
+
export declare function ClientContextDeclaration(props: ClientContextDeclarationProps): import("@alloy-js/core").Children;
|
|
8
7
|
//# sourceMappingURL=client-context-declaration.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client-context-declaration.d.ts","sourceRoot":"","sources":["../../../../src/components/client-context/client-context-declaration.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"client-context-declaration.d.ts","sourceRoot":"","sources":["../../../../src/components/client-context/client-context-declaration.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAG5C,MAAM,WAAW,6BAA6B;IAC5C,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC;CACnB;AAED,wBAAgB,8BAA8B,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,mCAE/D;AAED,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,6BAA6B,qCAY5E"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { createComponent as _$createComponent } from "@alloy-js/core/jsx-runtime";
|
|
2
|
-
import
|
|
2
|
+
import { refkey } from "@alloy-js/core";
|
|
3
3
|
import * as ts from "@alloy-js/typescript";
|
|
4
4
|
import { httpRuntimeTemplateLib } from "../external-packages/ts-http-runtime.js";
|
|
5
5
|
export function getClientcontextDeclarationRef(client) {
|
|
6
|
-
return
|
|
6
|
+
return refkey(client, "declaration");
|
|
7
7
|
}
|
|
8
8
|
export function ClientContextDeclaration(props) {
|
|
9
9
|
const ref = getClientcontextDeclarationRef(props.client);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Children, Refkey } from "@alloy-js/core";
|
|
2
2
|
import * as cl from "@typespec/http-client";
|
|
3
3
|
export interface ClientContextFactoryProps {
|
|
4
4
|
client: cl.Client;
|
|
5
5
|
}
|
|
6
|
-
export declare function getClientContextFactoryRef(client: cl.Client):
|
|
7
|
-
export declare function ClientContextFactoryDeclaration(props: ClientContextFactoryProps):
|
|
6
|
+
export declare function getClientContextFactoryRef(client: cl.Client): Refkey;
|
|
7
|
+
export declare function ClientContextFactoryDeclaration(props: ClientContextFactoryProps): Children;
|
|
8
8
|
//# sourceMappingURL=client-context-factory.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client-context-factory.d.ts","sourceRoot":"","sources":["../../../../src/components/client-context/client-context-factory.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"client-context-factory.d.ts","sourceRoot":"","sources":["../../../../src/components/client-context/client-context-factory.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAqB,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAKrE,OAAO,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAQ5C,MAAM,WAAW,yBAAyB;IACxC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC;CACnB;AAED,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,UAE3D;AAED,wBAAgB,+BAA+B,CAAC,KAAK,EAAE,yBAAyB,YA+C/E"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createComponent as _$createComponent, memo as _$memo } from "@alloy-js/core/jsx-runtime";
|
|
2
|
-
import
|
|
2
|
+
import { For, List, refkey } from "@alloy-js/core";
|
|
3
3
|
import * as ts from "@alloy-js/typescript";
|
|
4
4
|
import { useTsp } from "@typespec/emitter-framework";
|
|
5
5
|
import { FunctionDeclaration } from "@typespec/emitter-framework/typescript";
|
|
@@ -10,7 +10,7 @@ import { addClientTestOptions } from "../testing/client-options.js";
|
|
|
10
10
|
import { getClientcontextDeclarationRef } from "./client-context-declaration.js";
|
|
11
11
|
import { ParametrizedEndpoint } from "./parametrized-endpoint.js";
|
|
12
12
|
export function getClientContextFactoryRef(client) {
|
|
13
|
-
return
|
|
13
|
+
return refkey(client, "contextFactory");
|
|
14
14
|
}
|
|
15
15
|
export function ClientContextFactoryDeclaration(props) {
|
|
16
16
|
const {
|
|
@@ -21,9 +21,9 @@ 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, refkey());
|
|
25
25
|
const urlTemplate = $.client.getUrlTemplate(props.client);
|
|
26
|
-
const endpointRef =
|
|
26
|
+
const endpointRef = refkey();
|
|
27
27
|
const resolvedEndpoint = _$createComponent(ParametrizedEndpoint, {
|
|
28
28
|
refkey: endpointRef,
|
|
29
29
|
get template() {
|
|
@@ -84,7 +84,7 @@ function AuthScheme(props) {
|
|
|
84
84
|
case "http":
|
|
85
85
|
return _$createComponent(ts.ObjectExpression, {
|
|
86
86
|
get children() {
|
|
87
|
-
return _$createComponent(
|
|
87
|
+
return _$createComponent(List, {
|
|
88
88
|
comma: true,
|
|
89
89
|
get children() {
|
|
90
90
|
return [_$createComponent(ts.ObjectProperty, {
|
|
@@ -109,7 +109,7 @@ function AuthScheme(props) {
|
|
|
109
109
|
}
|
|
110
110
|
return _$createComponent(ts.ObjectExpression, {
|
|
111
111
|
get children() {
|
|
112
|
-
return _$createComponent(
|
|
112
|
+
return _$createComponent(List, {
|
|
113
113
|
comma: true,
|
|
114
114
|
get children() {
|
|
115
115
|
return [_$createComponent(ts.ObjectProperty, {
|
|
@@ -133,7 +133,7 @@ function AuthScheme(props) {
|
|
|
133
133
|
case "oauth2":
|
|
134
134
|
return _$createComponent(ts.ObjectExpression, {
|
|
135
135
|
get children() {
|
|
136
|
-
return _$createComponent(
|
|
136
|
+
return _$createComponent(List, {
|
|
137
137
|
comma: true,
|
|
138
138
|
get children() {
|
|
139
139
|
return [_$createComponent(ts.ObjectProperty, {
|
|
@@ -142,7 +142,7 @@ function AuthScheme(props) {
|
|
|
142
142
|
}), _$createComponent(ts.ObjectProperty, {
|
|
143
143
|
name: "flows",
|
|
144
144
|
get children() {
|
|
145
|
-
return ["[", _$createComponent(
|
|
145
|
+
return ["[", _$createComponent(For, {
|
|
146
146
|
get each() {
|
|
147
147
|
return props.scheme.flows;
|
|
148
148
|
},
|
|
@@ -192,7 +192,7 @@ function AuthSchemeOptions(props) {
|
|
|
192
192
|
return _$createComponent(ts.ObjectProperty, {
|
|
193
193
|
name: "authSchemes",
|
|
194
194
|
get children() {
|
|
195
|
-
return ["[", _$createComponent(
|
|
195
|
+
return ["[", _$createComponent(For, {
|
|
196
196
|
each: supportedSchemes,
|
|
197
197
|
comma: true,
|
|
198
198
|
line: true,
|
|
@@ -219,7 +219,7 @@ function ClientOptionsExpression(props) {
|
|
|
219
219
|
}
|
|
220
220
|
return _$createComponent(ts.ObjectExpression, {
|
|
221
221
|
get children() {
|
|
222
|
-
return _$createComponent(
|
|
222
|
+
return _$createComponent(For, {
|
|
223
223
|
each: options,
|
|
224
224
|
joiner: ",",
|
|
225
225
|
line: true,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Children } from "@alloy-js/core";
|
|
2
2
|
import * as cl from "@typespec/http-client";
|
|
3
3
|
export interface ClientContextOptionsDeclarationProps {
|
|
4
4
|
client: cl.Client;
|
|
5
5
|
}
|
|
6
|
-
export declare function getClientContextOptionsRef(client: cl.Client):
|
|
7
|
-
export declare function ClientContextOptionsDeclaration(props: ClientContextOptionsDeclarationProps):
|
|
6
|
+
export declare function getClientContextOptionsRef(client: cl.Client): import("@alloy-js/core").Refkey;
|
|
7
|
+
export declare function ClientContextOptionsDeclaration(props: ClientContextOptionsDeclarationProps): Children;
|
|
8
8
|
//# sourceMappingURL=client-context-options.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client-context-options.d.ts","sourceRoot":"","sources":["../../../../src/components/client-context/client-context-options.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"client-context-options.d.ts","sourceRoot":"","sources":["../../../../src/components/client-context/client-context-options.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAe,MAAM,gBAAgB,CAAC;AAEvD,OAAO,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAG5C,MAAM,WAAW,oCAAoC;IACnD,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC;CACnB;AAED,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,mCAE3D;AAED,wBAAgB,+BAA+B,CAAC,KAAK,EAAE,oCAAoC,YAqB1F"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { createComponent as _$createComponent } from "@alloy-js/core/jsx-runtime";
|
|
2
|
-
import
|
|
2
|
+
import { For, refkey } from "@alloy-js/core";
|
|
3
3
|
import * as ts from "@alloy-js/typescript";
|
|
4
4
|
import { httpRuntimeTemplateLib } from "../external-packages/ts-http-runtime.js";
|
|
5
5
|
export function getClientContextOptionsRef(client) {
|
|
6
|
-
return
|
|
6
|
+
return refkey(client, "options");
|
|
7
7
|
}
|
|
8
8
|
export function ClientContextOptionsDeclaration(props) {
|
|
9
9
|
const ref = getClientContextOptionsRef(props.client);
|
|
@@ -24,7 +24,7 @@ export function ClientContextOptionsDeclaration(props) {
|
|
|
24
24
|
});
|
|
25
25
|
},
|
|
26
26
|
get children() {
|
|
27
|
-
return [_$createComponent(
|
|
27
|
+
return [_$createComponent(For, {
|
|
28
28
|
get each() {
|
|
29
29
|
return Array.from(clientOptions.entries());
|
|
30
30
|
},
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { type Children } from "@alloy-js/core";
|
|
2
2
|
import * as cl from "@typespec/http-client";
|
|
3
3
|
export interface ClientContextProps {
|
|
4
4
|
client: cl.Client;
|
|
5
|
-
children?:
|
|
5
|
+
children?: Children;
|
|
6
6
|
}
|
|
7
|
-
export declare function ClientContext(props: ClientContextProps):
|
|
7
|
+
export declare function ClientContext(props: ClientContextProps): Children;
|
|
8
8
|
//# sourceMappingURL=client-context.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client-context.d.ts","sourceRoot":"","sources":["../../../../src/components/client-context/client-context.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"client-context.d.ts","sourceRoot":"","sources":["../../../../src/components/client-context/client-context.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE/C,OAAO,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAK5C,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,YAUtD"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Refkey } from "@alloy-js/core";
|
|
2
2
|
import { ModelProperty } from "@typespec/compiler";
|
|
3
3
|
export interface ParametrizedEndpointProps {
|
|
4
|
-
refkey:
|
|
4
|
+
refkey: Refkey;
|
|
5
5
|
template: string;
|
|
6
6
|
params: ModelProperty[];
|
|
7
7
|
}
|
|
8
|
-
export declare function ParametrizedEndpoint(props: ParametrizedEndpointProps):
|
|
8
|
+
export declare function ParametrizedEndpoint(props: ParametrizedEndpointProps): import("@alloy-js/core").Children;
|
|
9
9
|
//# sourceMappingURL=parametrized-endpoint.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parametrized-endpoint.d.ts","sourceRoot":"","sources":["../../../../src/components/client-context/parametrized-endpoint.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"parametrized-endpoint.d.ts","sourceRoot":"","sources":["../../../../src/components/client-context/parametrized-endpoint.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAa,MAAM,EAAyB,MAAM,gBAAgB,CAAC;AAE1E,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAInD,MAAM,WAAW,yBAAyB;IACxC,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,aAAa,EAAE,CAAC;CACzB;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,yBAAyB,qCAqCpE"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { createComponent as _$createComponent, memo as _$memo } from "@alloy-js/core/jsx-runtime";
|
|
2
|
-
import
|
|
2
|
+
import { code, For, refkey, StatementList } from "@alloy-js/core";
|
|
3
3
|
import * as ts from "@alloy-js/typescript";
|
|
4
4
|
import { useTransformNamePolicy } from "@typespec/emitter-framework";
|
|
5
5
|
import { getDefaultValue } from "../../utils/parameters.js";
|
|
6
6
|
export function ParametrizedEndpoint(props) {
|
|
7
7
|
const propNamer = useTransformNamePolicy();
|
|
8
|
-
const paramsRef =
|
|
8
|
+
const paramsRef = refkey();
|
|
9
9
|
const params = _$createComponent(ts.VarDeclaration, {
|
|
10
10
|
name: "params",
|
|
11
11
|
type: "Record<string, any>",
|
|
@@ -13,7 +13,7 @@ export function ParametrizedEndpoint(props) {
|
|
|
13
13
|
get children() {
|
|
14
14
|
return _$createComponent(ts.ObjectExpression, {
|
|
15
15
|
get children() {
|
|
16
|
-
return _$createComponent(
|
|
16
|
+
return _$createComponent(For, {
|
|
17
17
|
get each() {
|
|
18
18
|
return props.params;
|
|
19
19
|
},
|
|
@@ -40,14 +40,14 @@ export function ParametrizedEndpoint(props) {
|
|
|
40
40
|
return props.refkey;
|
|
41
41
|
},
|
|
42
42
|
get children() {
|
|
43
|
-
return
|
|
43
|
+
return code`
|
|
44
44
|
"${props.template}".replace(/{([^}]+)}/g, (_, key) =>
|
|
45
45
|
key in ${paramsRef} ? String(params[key]) : (() => { throw new Error(\`Missing parameter: $\{key}\`); })()
|
|
46
46
|
);
|
|
47
47
|
`;
|
|
48
48
|
}
|
|
49
49
|
});
|
|
50
|
-
return _$createComponent(
|
|
50
|
+
return _$createComponent(StatementList, {
|
|
51
51
|
get children() {
|
|
52
52
|
return [params, resolvedEndpoint];
|
|
53
53
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Children } from "@alloy-js/core";
|
|
2
2
|
import * as cl from "@typespec/http-client";
|
|
3
3
|
export interface OperationsDirectoryProps {
|
|
4
|
-
children?:
|
|
4
|
+
children?: Children;
|
|
5
5
|
}
|
|
6
|
-
export declare function OperationsDirectory(props: OperationsDirectoryProps):
|
|
6
|
+
export declare function OperationsDirectory(props: OperationsDirectoryProps): Children;
|
|
7
7
|
export interface SubClientsProps {
|
|
8
8
|
client: cl.Client;
|
|
9
9
|
}
|
|
10
|
-
export declare function SubClients(props: SubClientsProps):
|
|
10
|
+
export declare function SubClients(props: SubClientsProps): Children;
|
|
11
11
|
//# sourceMappingURL=client-directory.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client-directory.d.ts","sourceRoot":"","sources":["../../../src/components/client-directory.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"client-directory.d.ts","sourceRoot":"","sources":["../../../src/components/client-directory.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAuC,MAAM,gBAAgB,CAAC;AAE/E,OAAO,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAK5C,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,wBAAwB,YAclE;AAED,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC;CACnB;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,YAkBhD"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createComponent as _$createComponent } from "@alloy-js/core/jsx-runtime";
|
|
2
|
-
import
|
|
2
|
+
import { For, SourceDirectory, StatementList } from "@alloy-js/core";
|
|
3
3
|
import * as ts from "@alloy-js/typescript";
|
|
4
4
|
import { useClientLibrary } from "@typespec/http-client";
|
|
5
5
|
import { ClientContext } from "./client-context/client-context.js";
|
|
@@ -9,11 +9,11 @@ export function OperationsDirectory(props) {
|
|
|
9
9
|
topLevel: clients
|
|
10
10
|
} = useClientLibrary();
|
|
11
11
|
// If it is the root client, we don't need to create a directory
|
|
12
|
-
return _$createComponent(
|
|
12
|
+
return _$createComponent(For, {
|
|
13
13
|
each: clients,
|
|
14
14
|
joiner: ",",
|
|
15
15
|
line: true,
|
|
16
|
-
children: client => _$createComponent(
|
|
16
|
+
children: client => _$createComponent(StatementList, {
|
|
17
17
|
get children() {
|
|
18
18
|
return [_$createComponent(ClientOperations, {
|
|
19
19
|
client: client
|
|
@@ -28,12 +28,12 @@ export function OperationsDirectory(props) {
|
|
|
28
28
|
}
|
|
29
29
|
export function SubClients(props) {
|
|
30
30
|
const subClients = props.client.subClients;
|
|
31
|
-
return _$createComponent(
|
|
31
|
+
return _$createComponent(For, {
|
|
32
32
|
each: subClients,
|
|
33
33
|
children: subClient => {
|
|
34
34
|
const namePolicy = ts.useTSNamePolicy();
|
|
35
35
|
const subClientName = namePolicy.getName(subClient.name, "variable");
|
|
36
|
-
return _$createComponent(
|
|
36
|
+
return _$createComponent(SourceDirectory, {
|
|
37
37
|
path: subClientName,
|
|
38
38
|
get children() {
|
|
39
39
|
return [_$createComponent(ClientOperations, {
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Refkey } from "@alloy-js/core";
|
|
2
2
|
import { HttpOperation } from "@typespec/http";
|
|
3
3
|
import * as cl from "@typespec/http-client";
|
|
4
4
|
export interface ClientOperationsProps {
|
|
5
5
|
client: cl.Client;
|
|
6
6
|
}
|
|
7
|
-
export declare function ClientOperations(props: ClientOperationsProps):
|
|
7
|
+
export declare function ClientOperations(props: ClientOperationsProps): import("@alloy-js/core").Children;
|
|
8
8
|
export interface ClientOperationProps {
|
|
9
9
|
httpOperation: HttpOperation;
|
|
10
|
-
refkey:
|
|
10
|
+
refkey: Refkey;
|
|
11
11
|
internal?: boolean;
|
|
12
12
|
}
|
|
13
|
-
export declare function ClientOperation(props: ClientOperationProps):
|
|
13
|
+
export declare function ClientOperation(props: ClientOperationProps): import("@alloy-js/core").Children;
|
|
14
14
|
//# sourceMappingURL=client-operation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client-operation.d.ts","sourceRoot":"","sources":["../../../src/components/client-operation.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"client-operation.d.ts","sourceRoot":"","sources":["../../../src/components/client-operation.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAa,MAAM,EAAU,MAAM,gBAAgB,CAAC;AAI3D,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,qCAqB5D;AAED,MAAM,WAAW,oBAAoB;IACnC,aAAa,EAAE,aAAa,CAAC;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAMD,wBAAgB,eAAe,CAAC,KAAK,EAAE,oBAAoB,qCAgD1D"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createComponent as _$createComponent } from "@alloy-js/core/jsx-runtime";
|
|
2
|
-
import
|
|
2
|
+
import { For, List, refkey } from "@alloy-js/core";
|
|
3
3
|
import * as ts from "@alloy-js/typescript";
|
|
4
4
|
import { useTsp } from "@typespec/emitter-framework";
|
|
5
5
|
import { FunctionDeclaration, TypeExpression } from "@typespec/emitter-framework/typescript";
|
|
@@ -22,7 +22,7 @@ export function ClientOperations(props) {
|
|
|
22
22
|
return _$createComponent(ts.SourceFile, {
|
|
23
23
|
path: `${fileName}.ts`,
|
|
24
24
|
get children() {
|
|
25
|
-
return _$createComponent(
|
|
25
|
+
return _$createComponent(For, {
|
|
26
26
|
each: clientOperations,
|
|
27
27
|
children: operation => _$createComponent(OperationPipeline, {
|
|
28
28
|
get httpOperation() {
|
|
@@ -37,7 +37,7 @@ export function ClientOperations(props) {
|
|
|
37
37
|
});
|
|
38
38
|
}
|
|
39
39
|
function getClientOperationOptionsParamRef(httpOperation) {
|
|
40
|
-
return
|
|
40
|
+
return refkey(httpOperation, "client-operation-options-parameter");
|
|
41
41
|
}
|
|
42
42
|
export function ClientOperation(props) {
|
|
43
43
|
const {
|
|
@@ -54,13 +54,13 @@ export function ClientOperation(props) {
|
|
|
54
54
|
return;
|
|
55
55
|
}
|
|
56
56
|
const returnType = $.httpOperation.getReturnType(props.httpOperation);
|
|
57
|
-
const responseRefkey =
|
|
57
|
+
const responseRefkey = refkey(props.httpOperation, "http-response");
|
|
58
58
|
const clientContextInterfaceRef = getClientcontextDeclarationRef(client);
|
|
59
59
|
const signatureParams = [{
|
|
60
60
|
name: "client",
|
|
61
61
|
type: clientContextInterfaceRef
|
|
62
62
|
}, ...getOperationParameters(props.httpOperation, optionsRefkey)];
|
|
63
|
-
return _$createComponent(
|
|
63
|
+
return _$createComponent(List, {
|
|
64
64
|
hardline: true,
|
|
65
65
|
get children() {
|
|
66
66
|
return [_$createComponent(OperationOptionsDeclaration, {
|
|
@@ -86,7 +86,7 @@ export function ClientOperation(props) {
|
|
|
86
86
|
return props.refkey;
|
|
87
87
|
},
|
|
88
88
|
get children() {
|
|
89
|
-
return _$createComponent(
|
|
89
|
+
return _$createComponent(List, {
|
|
90
90
|
hardline: true,
|
|
91
91
|
get children() {
|
|
92
92
|
return [_$createComponent(HttpRequest, {
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Refkey } from "@alloy-js/core";
|
|
2
2
|
import * as cl from "@typespec/http-client";
|
|
3
3
|
export interface ClientProps {
|
|
4
4
|
}
|
|
5
|
-
export declare function Client(props: ClientProps):
|
|
5
|
+
export declare function Client(props: ClientProps): import("@alloy-js/core").Children;
|
|
6
6
|
export interface ClientClassProps {
|
|
7
7
|
client: cl.Client;
|
|
8
8
|
}
|
|
9
|
-
export declare function getClientClassRef(client: cl.Client):
|
|
10
|
-
export declare function ClientClass(props: ClientClassProps):
|
|
9
|
+
export declare function getClientClassRef(client: cl.Client): Refkey;
|
|
10
|
+
export declare function ClientClass(props: ClientClassProps): import("@alloy-js/core").Children;
|
|
11
11
|
export interface NewClientExpressionProps {
|
|
12
12
|
client: cl.Client;
|
|
13
|
-
args:
|
|
13
|
+
args: Refkey[];
|
|
14
14
|
}
|
|
15
15
|
//# sourceMappingURL=client.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/components/client.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/components/client.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAa,MAAM,EAAU,MAAM,gBAAgB,CAAC;AAI3D,OAAO,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAQ5C,MAAM,WAAW,WAAW;CAAG;AAE/B,wBAAgB,MAAM,CAAC,KAAK,EAAE,WAAW,qCAoBxC;AAED,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC;CACnB;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,UAElD;AAKD,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,qCAiDlD;AAkED,MAAM,WAAW,wBAAwB;IACvC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,EAAE,CAAC;CAChB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createComponent as _$createComponent, createIntrinsic as _$createIntrinsic } from "@alloy-js/core/jsx-runtime";
|
|
2
|
-
import
|
|
2
|
+
import { For, List, refkey } from "@alloy-js/core";
|
|
3
3
|
import * as ts from "@alloy-js/typescript";
|
|
4
4
|
import { useTsp } from "@typespec/emitter-framework";
|
|
5
5
|
import { ClassMethod } from "@typespec/emitter-framework/typescript";
|
|
@@ -17,7 +17,7 @@ export function Client(props) {
|
|
|
17
17
|
const {
|
|
18
18
|
topLevel
|
|
19
19
|
} = useClientLibrary();
|
|
20
|
-
return _$createComponent(
|
|
20
|
+
return _$createComponent(For, {
|
|
21
21
|
each: topLevel,
|
|
22
22
|
hardline: true,
|
|
23
23
|
children: client => {
|
|
@@ -26,7 +26,7 @@ export function Client(props) {
|
|
|
26
26
|
return _$createComponent(ts.SourceFile, {
|
|
27
27
|
path: `${fileName}.ts`,
|
|
28
28
|
get children() {
|
|
29
|
-
return _$createComponent(
|
|
29
|
+
return _$createComponent(For, {
|
|
30
30
|
each: flatClients,
|
|
31
31
|
hardline: true,
|
|
32
32
|
children: client => _$createComponent(ClientClass, {
|
|
@@ -39,10 +39,10 @@ export function Client(props) {
|
|
|
39
39
|
});
|
|
40
40
|
}
|
|
41
41
|
export function getClientClassRef(client) {
|
|
42
|
-
return
|
|
42
|
+
return refkey(client.type, "client-class");
|
|
43
43
|
}
|
|
44
44
|
function getClientContextFieldRef(client) {
|
|
45
|
-
return
|
|
45
|
+
return refkey(client.type, "client-context");
|
|
46
46
|
}
|
|
47
47
|
export function ClientClass(props) {
|
|
48
48
|
const {
|
|
@@ -60,7 +60,7 @@ export function ClientClass(props) {
|
|
|
60
60
|
name: clientName,
|
|
61
61
|
refkey: clientClassRef,
|
|
62
62
|
get children() {
|
|
63
|
-
return _$createComponent(
|
|
63
|
+
return _$createComponent(List, {
|
|
64
64
|
hardline: true,
|
|
65
65
|
get children() {
|
|
66
66
|
return [_$createComponent(ts.ClassField, {
|
|
@@ -68,7 +68,7 @@ export function ClientClass(props) {
|
|
|
68
68
|
jsPrivate: true,
|
|
69
69
|
refkey: contextMemberRef,
|
|
70
70
|
type: contextDeclarationRef
|
|
71
|
-
}), _$createComponent(
|
|
71
|
+
}), _$createComponent(For, {
|
|
72
72
|
each: subClients,
|
|
73
73
|
hardline: true,
|
|
74
74
|
semicolon: true,
|
|
@@ -79,12 +79,12 @@ export function ClientClass(props) {
|
|
|
79
79
|
get client() {
|
|
80
80
|
return props.client;
|
|
81
81
|
}
|
|
82
|
-
}), _$createComponent(
|
|
82
|
+
}), _$createComponent(For, {
|
|
83
83
|
each: operations,
|
|
84
84
|
hardline: true,
|
|
85
85
|
semicolon: true,
|
|
86
86
|
children: op => {
|
|
87
|
-
const parameters = getOperationParameters(op.httpOperation,
|
|
87
|
+
const parameters = getOperationParameters(op.httpOperation, 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, {
|
|
@@ -98,7 +98,7 @@ export function ClientClass(props) {
|
|
|
98
98
|
get children() {
|
|
99
99
|
return ["return", " ", _$createComponent(ts.FunctionCallExpression, {
|
|
100
100
|
get target() {
|
|
101
|
-
return
|
|
101
|
+
return refkey(op.httpOperation.operation);
|
|
102
102
|
},
|
|
103
103
|
get args() {
|
|
104
104
|
return [contextMemberRef, ...args];
|
|
@@ -114,7 +114,7 @@ export function ClientClass(props) {
|
|
|
114
114
|
});
|
|
115
115
|
}
|
|
116
116
|
function getSubClientClassFieldRef(client) {
|
|
117
|
-
return
|
|
117
|
+
return refkey(client.type, "client-field");
|
|
118
118
|
}
|
|
119
119
|
function SubClientClassField(props) {
|
|
120
120
|
const {
|
|
@@ -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, refkey());
|
|
147
147
|
const args = Object.values(constructorParameters).map(p => p.refkey);
|
|
148
148
|
return _$createComponent(ts.ClassMethod, {
|
|
149
149
|
name: "constructor",
|
|
@@ -152,7 +152,7 @@ function ClientConstructor(props) {
|
|
|
152
152
|
return [clientContextFieldRef, " =", " ", _$createComponent(ts.FunctionCallExpression, {
|
|
153
153
|
target: clientContextFactoryRef,
|
|
154
154
|
args: args
|
|
155
|
-
}), ";", _$createIntrinsic("br", {}), _$createComponent(
|
|
155
|
+
}), ";", _$createIntrinsic("br", {}), _$createComponent(For, {
|
|
156
156
|
each: subClients,
|
|
157
157
|
joiner: ";",
|
|
158
158
|
hardline: true,
|
|
@@ -169,7 +169,7 @@ function ClientConstructor(props) {
|
|
|
169
169
|
});
|
|
170
170
|
}
|
|
171
171
|
function calculateSubClientArgs(subClient, parentParams) {
|
|
172
|
-
const subClientParams = buildClientParameters(subClient,
|
|
172
|
+
const subClientParams = buildClientParameters(subClient, 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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"encoding-provider.d.ts","sourceRoot":"","sources":["../../../src/components/encoding-provider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"encoding-provider.d.ts","sourceRoot":"","sources":["../../../src/components/encoding-provider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,EAAE,gBAAgB,CAAC;IAC5B,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,YAQ5D"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Children } from "@alloy-js/core";
|
|
2
2
|
import { HttpOperation, HttpProperty } from "@typespec/http";
|
|
3
3
|
export interface HttpRequestParametersExpressionProps {
|
|
4
4
|
httpOperation: HttpOperation;
|
|
5
|
-
optionsParameter:
|
|
5
|
+
optionsParameter: Children;
|
|
6
6
|
parameters?: HttpProperty[];
|
|
7
|
-
children?:
|
|
7
|
+
children?: Children;
|
|
8
8
|
}
|
|
9
|
-
export declare function HttpRequestParametersExpression(props: HttpRequestParametersExpressionProps):
|
|
9
|
+
export declare function HttpRequestParametersExpression(props: HttpRequestParametersExpressionProps): Children;
|
|
10
10
|
//# sourceMappingURL=http-request-parameters-expression.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http-request-parameters-expression.d.ts","sourceRoot":"","sources":["../../../src/components/http-request-parameters-expression.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"http-request-parameters-expression.d.ts","sourceRoot":"","sources":["../../../src/components/http-request-parameters-expression.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAqD,MAAM,gBAAgB,CAAC;AAG7F,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG7D,MAAM,WAAW,oCAAoC;IACnD,aAAa,EAAE,aAAa,CAAC;IAC7B,gBAAgB,EAAE,QAAQ,CAAC;IAC3B,UAAU,CAAC,EAAE,YAAY,EAAE,CAAC;IAC5B,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB;AAED,wBAAgB,+BAA+B,CAAC,KAAK,EAAE,oCAAoC,YA4D1F"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { memo as _$memo, createComponent as _$createComponent } from "@alloy-js/core/jsx-runtime";
|
|
2
|
-
import
|
|
2
|
+
import { code, For, List, NamePolicyContext, useNamePolicy } from "@alloy-js/core";
|
|
3
3
|
import * as ts from "@alloy-js/typescript";
|
|
4
4
|
import { useTransformNamePolicy } from "@typespec/emitter-framework";
|
|
5
5
|
import { getDefaultValue, hasDefaultValue } from "../utils/parameters.js";
|
|
@@ -18,7 +18,7 @@ export function HttpRequestParametersExpression(props) {
|
|
|
18
18
|
return _$createComponent(ts.ObjectExpression, {});
|
|
19
19
|
}
|
|
20
20
|
const optionsParamRef = props.optionsParameter ?? "options";
|
|
21
|
-
const members = _$createComponent(
|
|
21
|
+
const members = _$createComponent(For, {
|
|
22
22
|
get each() {
|
|
23
23
|
return props.parameters;
|
|
24
24
|
},
|
|
@@ -30,7 +30,7 @@ export function HttpRequestParametersExpression(props) {
|
|
|
30
30
|
const transportParamName = transformNamer.getTransportName(httpProperty.property);
|
|
31
31
|
if (defaultValue) {
|
|
32
32
|
const paramValue = [_$memo(() => propertyExpression.fullExpression), ` ?? ${defaultValue}`];
|
|
33
|
-
return _$createComponent(
|
|
33
|
+
return _$createComponent(NamePolicyContext.Provider, {
|
|
34
34
|
value: {
|
|
35
35
|
getName: n => n
|
|
36
36
|
},
|
|
@@ -43,7 +43,7 @@ export function HttpRequestParametersExpression(props) {
|
|
|
43
43
|
});
|
|
44
44
|
}
|
|
45
45
|
if (propertyExpression.isNullish) {
|
|
46
|
-
return
|
|
46
|
+
return code`
|
|
47
47
|
...(${propertyExpression.fullExpression} && {${_$createComponent(JsonTransform, {
|
|
48
48
|
get itemRef() {
|
|
49
49
|
return propertyExpression.leadingExpression;
|
|
@@ -93,7 +93,7 @@ export function HttpRequestParametersExpression(props) {
|
|
|
93
93
|
function buildMemberChainExpression(httpOperation, httpProperty, optionsParamRef) {
|
|
94
94
|
const segments = [];
|
|
95
95
|
let isNullish = httpProperty.property.optional === true;
|
|
96
|
-
const namePolicy =
|
|
96
|
+
const namePolicy = useNamePolicy();
|
|
97
97
|
const propertyApplicationName = namePolicy.getName(httpProperty.property.name, "property");
|
|
98
98
|
|
|
99
99
|
// If the property is at the top level, return early
|
|
@@ -102,8 +102,8 @@ function buildMemberChainExpression(httpOperation, httpProperty, optionsParamRef
|
|
|
102
102
|
return {
|
|
103
103
|
propertyName: propertyApplicationName,
|
|
104
104
|
isNullish,
|
|
105
|
-
fullExpression:
|
|
106
|
-
leadingExpression:
|
|
105
|
+
fullExpression: code`${optionsParamRef}?.${propertyApplicationName}`,
|
|
106
|
+
leadingExpression: code`${optionsParamRef}`
|
|
107
107
|
};
|
|
108
108
|
}
|
|
109
109
|
return {
|
|
@@ -133,7 +133,7 @@ function buildMemberChainExpression(httpOperation, httpProperty, optionsParamRef
|
|
|
133
133
|
|
|
134
134
|
// Use direct property access if possible.
|
|
135
135
|
if (isValidIdentifier(parentName)) {
|
|
136
|
-
segments.unshift(
|
|
136
|
+
segments.unshift(code`${parentName}`);
|
|
137
137
|
} else {
|
|
138
138
|
// For non-valid identifiers, use bracket notation.
|
|
139
139
|
segments.unshift(`[${JSON.stringify(parentName)}]`);
|
|
@@ -142,10 +142,10 @@ function buildMemberChainExpression(httpOperation, httpProperty, optionsParamRef
|
|
|
142
142
|
// Remove the last element to move one level up.
|
|
143
143
|
currentPath = currentPath.slice(0, -1);
|
|
144
144
|
}
|
|
145
|
-
const fullExpression = [_$createComponent(
|
|
145
|
+
const fullExpression = [_$createComponent(List, {
|
|
146
146
|
children: segments
|
|
147
147
|
}), propertyApplicationName];
|
|
148
|
-
const leadingExpression = _$createComponent(
|
|
148
|
+
const leadingExpression = _$createComponent(List, {
|
|
149
149
|
get children() {
|
|
150
150
|
return segments.slice(0, -1);
|
|
151
151
|
}
|