@typespec/http-client-js 0.1.0 → 0.2.0-dev.10
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/.github/copilot-instructions.md +193 -0
- package/README.md +31 -15
- package/dist/src/components/client-context/client-context-declaration.d.ts.map +1 -1
- package/dist/src/components/client-context/client-context-declaration.js.map +1 -1
- package/dist/src/components/client-context/client-context-factory.d.ts.map +1 -1
- package/dist/src/components/client-context/client-context-factory.js +7 -4
- package/dist/src/components/client-context/client-context-factory.js.map +1 -1
- package/dist/src/components/client-context/client-context-options.d.ts.map +1 -1
- package/dist/src/components/client-context/client-context-options.js +13 -9
- package/dist/src/components/client-context/client-context-options.js.map +1 -1
- package/dist/src/components/client-context/client-context.d.ts.map +1 -1
- package/dist/src/components/client-context/client-context.js +7 -12
- package/dist/src/components/client-context/client-context.js.map +1 -1
- package/dist/src/components/client-context/parametrized-endpoint.d.ts +1 -1
- package/dist/src/components/client-context/parametrized-endpoint.d.ts.map +1 -1
- package/dist/src/components/client-context/parametrized-endpoint.js +22 -13
- package/dist/src/components/client-context/parametrized-endpoint.js.map +1 -1
- package/dist/src/components/client-directory.d.ts +2 -2
- package/dist/src/components/client-directory.d.ts.map +1 -1
- package/dist/src/components/client-directory.js +33 -21
- package/dist/src/components/client-directory.js.map +1 -1
- 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-operation.js.map +1 -1
- package/dist/src/components/client.d.ts +1 -1
- package/dist/src/components/client.d.ts.map +1 -1
- package/dist/src/components/client.js +83 -64
- package/dist/src/components/client.js.map +1 -1
- package/dist/src/components/encoding-provider.d.ts.map +1 -1
- package/dist/src/components/encoding-provider.js +0 -1
- package/dist/src/components/encoding-provider.js.map +1 -1
- package/dist/src/components/http-request-options.d.ts.map +1 -1
- package/dist/src/components/http-request-options.js +3 -3
- package/dist/src/components/http-request-options.js.map +1 -1
- package/dist/src/components/http-request-parameters-expression.d.ts +1 -2
- package/dist/src/components/http-request-parameters-expression.d.ts.map +1 -1
- package/dist/src/components/http-request-parameters-expression.js +37 -33
- package/dist/src/components/http-request-parameters-expression.js.map +1 -1
- package/dist/src/components/http-request.d.ts.map +1 -1
- package/dist/src/components/http-request.js +24 -20
- package/dist/src/components/http-request.js.map +1 -1
- package/dist/src/components/http-response.d.ts +1 -1
- package/dist/src/components/http-response.d.ts.map +1 -1
- package/dist/src/components/http-response.js +36 -33
- package/dist/src/components/http-response.js.map +1 -1
- package/dist/src/components/models.d.ts.map +1 -1
- package/dist/src/components/models.js +21 -18
- package/dist/src/components/models.js.map +1 -1
- package/dist/src/components/operation-options.d.ts.map +1 -1
- package/dist/src/components/operation-options.js +17 -14
- package/dist/src/components/operation-options.js.map +1 -1
- package/dist/src/components/output.d.ts.map +1 -1
- package/dist/src/components/output.js +2 -1
- package/dist/src/components/output.js.map +1 -1
- package/dist/src/components/serializers.d.ts.map +1 -1
- package/dist/src/components/serializers.js +21 -14
- package/dist/src/components/serializers.js.map +1 -1
- package/dist/src/components/static-helpers/bytes-encoding.d.ts.map +1 -1
- package/dist/src/components/static-helpers/bytes-encoding.js +2 -2
- package/dist/src/components/static-helpers/bytes-encoding.js.map +1 -1
- package/dist/src/components/static-helpers/interfaces.d.ts.map +1 -1
- package/dist/src/components/static-helpers/interfaces.js.map +1 -1
- package/dist/src/components/static-helpers/multipart-helpers.d.ts.map +1 -1
- package/dist/src/components/static-helpers/multipart-helpers.js +4 -4
- package/dist/src/components/static-helpers/multipart-helpers.js.map +1 -1
- package/dist/src/components/static-helpers/rest-error.d.ts.map +1 -1
- package/dist/src/components/static-helpers/rest-error.js +66 -57
- package/dist/src/components/static-helpers/rest-error.js.map +1 -1
- package/dist/src/components/testing/client-options.d.ts.map +1 -1
- package/dist/src/components/testing/client-options.js +0 -2
- package/dist/src/components/testing/client-options.js.map +1 -1
- package/dist/src/components/transforms/content-type-encoding-provider.d.ts.map +1 -1
- package/dist/src/components/transforms/content-type-encoding-provider.js +0 -1
- package/dist/src/components/transforms/content-type-encoding-provider.js.map +1 -1
- package/dist/src/components/transforms/json/json-array-transform.d.ts.map +1 -1
- package/dist/src/components/transforms/json/json-array-transform.js.map +1 -1
- 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-additional-properties-transform.js.map +1 -1
- package/dist/src/components/transforms/json/json-model-base-transform.d.ts.map +1 -1
- package/dist/src/components/transforms/json/json-model-base-transform.js.map +1 -1
- 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.map +1 -1
- package/dist/src/components/transforms/json/json-model-transform.d.ts.map +1 -1
- package/dist/src/components/transforms/json/json-model-transform.js +20 -17
- package/dist/src/components/transforms/json/json-model-transform.js.map +1 -1
- package/dist/src/components/transforms/json/json-record-transform.d.ts.map +1 -1
- package/dist/src/components/transforms/json/json-record-transform.js.map +1 -1
- package/dist/src/components/transforms/json/json-transform-discriminator.d.ts.map +1 -1
- package/dist/src/components/transforms/json/json-transform-discriminator.js +5 -10
- package/dist/src/components/transforms/json/json-transform-discriminator.js.map +1 -1
- package/dist/src/components/transforms/json/json-transform.d.ts.map +1 -1
- package/dist/src/components/transforms/json/json-transform.js.map +1 -1
- package/dist/src/components/transforms/json/union-transform.d.ts.map +1 -1
- package/dist/src/components/transforms/json/union-transform.js +2 -2
- package/dist/src/components/transforms/json/union-transform.js.map +1 -1
- package/dist/src/components/transforms/multipart/array-part-transform.d.ts.map +1 -1
- package/dist/src/components/transforms/multipart/array-part-transform.js.map +1 -1
- package/dist/src/components/transforms/multipart/file-part-transform.js +1 -1
- package/dist/src/components/transforms/multipart/file-part-transform.js.map +1 -1
- package/dist/src/components/transforms/multipart/multipart-transform.d.ts.map +1 -1
- package/dist/src/components/transforms/multipart/multipart-transform.js +9 -6
- package/dist/src/components/transforms/multipart/multipart-transform.js.map +1 -1
- package/dist/src/components/transforms/multipart/simple-part-transform.d.ts.map +1 -1
- package/dist/src/components/transforms/multipart/simple-part-transform.js +23 -13
- package/dist/src/components/transforms/multipart/simple-part-transform.js.map +1 -1
- package/dist/src/components/transforms/operation-transform-declaration.d.ts.map +1 -1
- package/dist/src/components/transforms/operation-transform-declaration.js +2 -2
- package/dist/src/components/transforms/operation-transform-declaration.js.map +1 -1
- package/dist/src/components/transforms/operation-transform-expression.d.ts.map +1 -1
- package/dist/src/components/transforms/operation-transform-expression.js.map +1 -1
- package/dist/src/components/utils/unpack-model-property.d.ts.map +1 -1
- package/dist/src/components/utils/unpack-model-property.js +11 -2
- package/dist/src/components/utils/unpack-model-property.js.map +1 -1
- package/dist/src/components/utils/url-template.d.ts.map +1 -1
- package/dist/src/components/utils/url-template.js.map +1 -1
- package/dist/src/emitter.d.ts.map +1 -1
- package/dist/src/emitter.js +6 -6
- package/dist/src/emitter.js.map +1 -1
- package/dist/src/lib.d.ts.map +1 -1
- package/dist/src/lib.js +2 -1
- package/dist/src/lib.js.map +1 -1
- package/dist/src/utils/operations.d.ts +13 -1
- package/dist/src/utils/operations.d.ts.map +1 -1
- package/dist/src/utils/operations.js +71 -0
- package/dist/src/utils/operations.js.map +1 -1
- package/dist/src/utils/parameters.d.ts.map +1 -1
- package/dist/src/utils/parameters.js +1 -1
- package/dist/src/utils/parameters.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/eng/scripts/emit-e2e.js +1 -1
- package/package.json +14 -13
- package/src/components/client-context/client-context-declaration.tsx +8 -1
- package/src/components/client-context/client-context-factory.tsx +50 -30
- package/src/components/client-context/client-context-options.tsx +13 -6
- package/src/components/client-context/client-context.tsx +5 -3
- package/src/components/client-context/parametrized-endpoint.tsx +26 -15
- package/src/components/client-directory.tsx +26 -16
- package/src/components/client-operation.tsx +24 -12
- package/src/components/client.tsx +77 -39
- package/src/components/encoding-provider.tsx +1 -3
- package/src/components/http-request-options.tsx +24 -14
- package/src/components/http-request-parameters-expression.tsx +34 -37
- package/src/components/http-request.tsx +26 -16
- package/src/components/http-response.tsx +31 -26
- package/src/components/models.tsx +18 -14
- package/src/components/operation-options.tsx +18 -5
- package/src/components/output.tsx +10 -9
- package/src/components/serializers.tsx +21 -9
- package/src/components/static-helpers/bytes-encoding.tsx +26 -8
- package/src/components/static-helpers/interfaces.tsx +14 -9
- package/src/components/static-helpers/multipart-helpers.tsx +34 -13
- package/src/components/static-helpers/rest-error.tsx +56 -18
- package/src/components/testing/client-options.tsx +0 -3
- package/src/components/transforms/content-type-encoding-provider.tsx +1 -3
- package/src/components/transforms/json/json-array-transform.tsx +6 -4
- package/src/components/transforms/json/json-model-additional-properties-transform.tsx +18 -13
- package/src/components/transforms/json/json-model-base-transform.tsx +6 -1
- package/src/components/transforms/json/json-model-property-transform.tsx +7 -9
- package/src/components/transforms/json/json-model-transform.tsx +44 -16
- package/src/components/transforms/json/json-record-transform.tsx +5 -3
- package/src/components/transforms/json/json-transform-discriminator.tsx +17 -30
- package/src/components/transforms/json/json-transform.tsx +5 -3
- package/src/components/transforms/json/union-transform.tsx +20 -8
- package/src/components/transforms/multipart/array-part-transform.tsx +6 -3
- package/src/components/transforms/multipart/file-part-transform.tsx +1 -1
- package/src/components/transforms/multipart/multipart-transform.tsx +4 -6
- package/src/components/transforms/multipart/part-transform.tsx +1 -1
- package/src/components/transforms/multipart/simple-part-transform.tsx +16 -13
- package/src/components/transforms/operation-transform-declaration.tsx +24 -7
- package/src/components/transforms/operation-transform-expression.tsx +12 -5
- package/src/components/utils/unpack-model-property.ts +13 -2
- package/src/components/utils/url-template.tsx +10 -6
- package/src/emitter.tsx +4 -3
- package/src/lib.ts +6 -1
- package/src/utils/operations.ts +96 -1
- package/src/utils/parameters.tsx +5 -1
- package/test/e2e/http/payload/multipart/main.test.ts +20 -24
- package/test/e2e/http/type/property/additional-properties/spreads.test.ts +4 -1
- package/test/scenarios/additional-properties/extends.md +0 -4
- package/test/scenarios/additional-properties/is.md +0 -4
- package/test/scenarios/additional-properties/spread.md +0 -4
- package/test/scenarios/auth/basic_auth.md +0 -1
- package/test/scenarios/auth/bearer.md +0 -1
- package/test/scenarios/auth/client_parameters.md +0 -1
- package/test/scenarios/auth/key_credential.md +0 -1
- package/test/scenarios/auth/sub_client_override.md +0 -2
- package/test/scenarios/client/dotted_namespace.md +0 -1
- package/test/scenarios/client/global_namespace.md +0 -5
- package/test/scenarios/client/multiple_top_level_clients.md +0 -2
- package/test/scenarios/client/nested_client.md +0 -2
- package/test/scenarios/encoding/bytes_body.md +0 -4
- package/test/scenarios/encoding/bytes_json_property.md +0 -5
- package/test/scenarios/encoding/bytes_nullable.md +0 -14
- package/test/scenarios/encoding/header_bytes.md +0 -12
- package/test/scenarios/encoding/header_date.md +0 -20
- package/test/scenarios/encoding/model_with_bytes_property.md +0 -5
- package/test/scenarios/encoding/query_bytes.md +0 -4
- package/test/scenarios/encoding/query_date.md +0 -20
- package/test/scenarios/http-operations/basic-request.md +0 -12
- package/test/scenarios/http-operations/basic-response.md +0 -19
- package/test/scenarios/http-operations/basic.md +0 -6
- package/test/scenarios/http-operations/constant-header.md +0 -4
- package/test/scenarios/http-operations/create-operation.md +0 -4
- package/test/scenarios/http-operations/on_response.md +0 -4
- package/test/scenarios/http-operations/optional-request-body.md +0 -5
- package/test/scenarios/http-operations/path-parameter-in-model.md +0 -4
- package/test/scenarios/http-operations/path-parameter.md +0 -4
- package/test/scenarios/http-operations/scalar-payload.md +0 -4
- package/test/scenarios/http-operations/with-parameters.md +0 -5
- package/test/scenarios/models/inheritance_2_discriminators.md +0 -24
- package/test/scenarios/models/inheritance_discriminator.md +0 -4
- package/test/scenarios/models/inline-models.md +1 -4
- package/test/scenarios/models/model_additional_properties.md +0 -4
- package/test/scenarios/models/model_extends.md +0 -4
- package/test/scenarios/models/model_spread.md +0 -2
- package/test/scenarios/models/nested_property.md +0 -4
- package/test/scenarios/models/property_references_property.md +0 -6
- package/test/scenarios/multipart/anonymous_part.md +2 -11
- package/test/scenarios/multipart/file.md +0 -12
- package/test/scenarios/multipart/file_content_type.md +15 -5
- package/test/scenarios/multipart/non-string-float.md +50 -0
- package/test/scenarios/multipart/simple_part.md +0 -4
- package/test/scenarios/operation-parameters/body_root_anonymous.md +2 -17
- package/test/scenarios/operation-parameters/constant_as_optional.md +0 -5
- package/test/scenarios/operation-parameters/default_value_as_optional.md +0 -5
- package/test/scenarios/operation-parameters/no_content_type.md +0 -5
- package/test/scenarios/operation-parameters/no_parameters.md +0 -5
- package/test/scenarios/operation-parameters/only_optional.md +0 -5
- package/test/scenarios/operation-parameters/only_required.md +0 -5
- package/test/scenarios/operation-parameters/reserved_names.md +0 -5
- package/test/scenarios/operation-parameters/spread_body.md +0 -5
- package/test/scenarios/operation-parameters/spread_with_nested.md +0 -5
- package/test/scenarios/operation-parameters/union_body.md +0 -6
- package/test/scenarios/operation-parameters/with_body_property.md +0 -5
- package/test/scenarios/operation-parameters/with_body_root.md +0 -5
- package/test/scenarios/serializers/arrays.md +0 -8
- package/test/scenarios/serializers/basic_model.md +0 -4
- package/test/scenarios/serializers/basic_model_wire_name.md +0 -2
- package/test/scenarios/serializers/discriminated_union.md +1 -1
- package/test/scenarios/serializers/discriminated_union_spread.md +1 -5
- package/test/scenarios/serializers/multipart.md +0 -4
- package/test/scenarios/serializers/polymorphic_single_level_inheritance.md +0 -5
- package/test/scenarios/serializers/property_references_property.md +72 -0
- package/test/scenarios/serializers/record.md +0 -4
- package/test/scenarios/serializers/scalars.md +0 -5
- package/test/scenarios/serializers/spread.md +0 -4
- package/test/scenarios/serializers/string_union.md +0 -4
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import * as ay from "@alloy-js/core";
|
|
2
|
-
import { Children, mapJoin } from "@alloy-js/core";
|
|
3
2
|
import * as ts from "@alloy-js/typescript";
|
|
4
3
|
import { useTransformNamePolicy } from "@typespec/emitter-framework";
|
|
5
4
|
import { HttpProperty } from "@typespec/http";
|
|
@@ -8,62 +7,60 @@ import { JsonTransform } from "./transforms/json/json-transform.jsx";
|
|
|
8
7
|
export interface HttpRequestParametersExpressionProps {
|
|
9
8
|
optionsParameter: ay.Children;
|
|
10
9
|
parameters?: HttpProperty[];
|
|
11
|
-
children?: Children;
|
|
10
|
+
children?: ay.Children;
|
|
12
11
|
}
|
|
13
12
|
|
|
14
13
|
export function HttpRequestParametersExpression(props: HttpRequestParametersExpressionProps) {
|
|
15
|
-
const parameters: Children[] = [];
|
|
14
|
+
const parameters: ay.Children[] = [];
|
|
16
15
|
const transformNamer = useTransformNamePolicy();
|
|
17
16
|
|
|
18
17
|
if (props.children || (Array.isArray(props.children) && props.children.length)) {
|
|
19
|
-
parameters.push(<>
|
|
20
|
-
{props.children},
|
|
21
|
-
|
|
22
|
-
</>);
|
|
18
|
+
parameters.push(<>{props.children},</>);
|
|
23
19
|
}
|
|
24
20
|
|
|
25
21
|
if (!props.parameters && parameters.length) {
|
|
26
|
-
return <ts.ObjectExpression>
|
|
27
|
-
{parameters}
|
|
28
|
-
</ts.ObjectExpression>;
|
|
22
|
+
return <ts.ObjectExpression>{parameters}</ts.ObjectExpression>;
|
|
29
23
|
} else if (!props.parameters) {
|
|
30
24
|
return <ts.ObjectExpression />;
|
|
31
25
|
}
|
|
32
26
|
|
|
33
27
|
const optionsParamRef = props.optionsParameter ?? "options";
|
|
34
|
-
const members =
|
|
35
|
-
props.parameters
|
|
36
|
-
|
|
37
|
-
|
|
28
|
+
const members = (
|
|
29
|
+
<ay.For each={props.parameters} line comma>
|
|
30
|
+
{(httpProperty) => {
|
|
31
|
+
const parameter = httpProperty.property;
|
|
38
32
|
|
|
39
|
-
|
|
40
|
-
|
|
33
|
+
const defaultValue = getDefaultValue(httpProperty);
|
|
34
|
+
const paramItemRef: ay.Children = transformNamer.getApplicationName(parameter);
|
|
41
35
|
|
|
42
|
-
|
|
36
|
+
const paramRef = ay.code`${optionsParamRef}?.${paramItemRef}`;
|
|
43
37
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
38
|
+
if (defaultValue) {
|
|
39
|
+
const defaultAssignment = defaultValue ? ` ?? ${defaultValue}` : "";
|
|
40
|
+
const headerValue = (
|
|
41
|
+
<>
|
|
42
|
+
{paramRef}
|
|
43
|
+
{defaultAssignment}
|
|
44
|
+
</>
|
|
45
|
+
);
|
|
46
|
+
const name = transformNamer.getTransportName(parameter);
|
|
47
|
+
const paramAssignment = <ts.ObjectProperty name={`"${name}"`} value={headerValue} />;
|
|
48
|
+
return paramAssignment;
|
|
49
|
+
}
|
|
51
50
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
...(${paramRef} && {${<JsonTransform itemRef={itemRef} type={parameter} target="transport"/>}})
|
|
51
|
+
const itemRef: ay.Children = parameter.optional ? ay.code`${optionsParamRef}?` : null;
|
|
52
|
+
if (parameter.optional) {
|
|
53
|
+
return ay.code`
|
|
54
|
+
...(${paramRef} && {${(<JsonTransform itemRef={itemRef} type={parameter} target="transport" />)}})
|
|
56
55
|
`;
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
56
|
+
} else {
|
|
57
|
+
return <JsonTransform itemRef={itemRef} type={parameter} target="transport" />;
|
|
58
|
+
}
|
|
59
|
+
}}
|
|
60
|
+
</ay.For>
|
|
62
61
|
);
|
|
63
62
|
|
|
64
|
-
parameters.push(
|
|
63
|
+
parameters.push(members);
|
|
65
64
|
|
|
66
|
-
return <ts.ObjectExpression>
|
|
67
|
-
{parameters}
|
|
68
|
-
</ts.ObjectExpression>;
|
|
65
|
+
return <ts.ObjectExpression>{parameters}</ts.ObjectExpression>;
|
|
69
66
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Children, code, refkey, Refkey } from "@alloy-js/core";
|
|
1
|
+
import { Children, code, refkey, Refkey, StatementList } from "@alloy-js/core";
|
|
2
2
|
import * as ts from "@alloy-js/typescript";
|
|
3
3
|
import { Reference } from "@alloy-js/typescript";
|
|
4
4
|
import { ClientOperation } from "@typespec/http-client";
|
|
@@ -18,23 +18,24 @@ export function HttpRequest(props: HttpRequestProps) {
|
|
|
18
18
|
const requestOptionsRefkey = refkey();
|
|
19
19
|
const httpResponseRefkey = props.responseRefkey ?? refkey();
|
|
20
20
|
const verb = props.operation.httpOperation.verb;
|
|
21
|
-
return
|
|
22
|
-
<
|
|
23
|
-
|
|
24
|
-
<HttpRequestOptions operation={props.operation} refkey={requestOptionsRefkey} />
|
|
21
|
+
return (
|
|
22
|
+
<StatementList>
|
|
23
|
+
<HttpRequest.Url operation={props.operation} refkey={operationUrlRefkey} />
|
|
25
24
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
<HttpRequestOptions operation={props.operation} refkey={requestOptionsRefkey} />
|
|
26
|
+
|
|
27
|
+
<ts.VarDeclaration name="response" refkey={httpResponseRefkey}>
|
|
28
|
+
{code`
|
|
29
|
+
await client.pathUnchecked(${(<Reference refkey={operationUrlRefkey} />)}).${verb}(${(<Reference refkey={requestOptionsRefkey} />)})
|
|
29
30
|
|
|
30
31
|
if (typeof options?.operationOptions?.onResponse === "function") {
|
|
31
32
|
options?.operationOptions?.onResponse(response);
|
|
32
33
|
}
|
|
33
34
|
|
|
34
35
|
`}
|
|
35
|
-
|
|
36
|
-
</
|
|
37
|
-
|
|
36
|
+
</ts.VarDeclaration>
|
|
37
|
+
</StatementList>
|
|
38
|
+
);
|
|
38
39
|
}
|
|
39
40
|
|
|
40
41
|
export interface HttpUrlProps {
|
|
@@ -50,9 +51,18 @@ HttpRequest.Url = function HttpUrlDeclaration(props: HttpUrlProps) {
|
|
|
50
51
|
(p) => p.kind === "path" || p.kind === "query",
|
|
51
52
|
);
|
|
52
53
|
const optionsParameter = getOperationOptionsParameterRefkey(props.operation.httpOperation);
|
|
53
|
-
return
|
|
54
|
-
<
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
54
|
+
return (
|
|
55
|
+
<EncodingProvider defaults={{ bytes: "base64url" }}>
|
|
56
|
+
<ts.VarDeclaration name="path" refkey={props.refkey}>
|
|
57
|
+
{uriTemplateLib.parse}({JSON.stringify(urlTemplate)}).expand(
|
|
58
|
+
{
|
|
59
|
+
<HttpRequestParametersExpression
|
|
60
|
+
optionsParameter={optionsParameter!}
|
|
61
|
+
parameters={urlParameters}
|
|
62
|
+
/>
|
|
63
|
+
}
|
|
64
|
+
)
|
|
65
|
+
</ts.VarDeclaration>
|
|
66
|
+
</EncodingProvider>
|
|
67
|
+
);
|
|
58
68
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Children, code,
|
|
1
|
+
import { Children, code, For, Refkey } from "@alloy-js/core";
|
|
2
2
|
import { isVoidType } from "@typespec/compiler";
|
|
3
3
|
import { $ } from "@typespec/compiler/experimental/typekit";
|
|
4
4
|
import { ClientOperation } from "@typespec/http-client";
|
|
@@ -12,11 +12,13 @@ export interface HttpResponseProps {
|
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
export function HttpResponse(props: HttpResponseProps) {
|
|
15
|
-
return
|
|
15
|
+
return (
|
|
16
|
+
<>
|
|
16
17
|
<HttpResponses operation={props.operation} />
|
|
17
18
|
|
|
18
19
|
{code`throw ${getCreateRestErrorRefkey()}(response);`}
|
|
19
|
-
|
|
20
|
+
</>
|
|
21
|
+
);
|
|
20
22
|
}
|
|
21
23
|
|
|
22
24
|
export interface HttpResponsesProps {
|
|
@@ -27,42 +29,45 @@ export interface HttpResponsesProps {
|
|
|
27
29
|
export function HttpResponses(props: HttpResponsesProps) {
|
|
28
30
|
// Handle response by status code and content type
|
|
29
31
|
const responses = $.httpOperation.flattenResponses(props.operation.httpOperation);
|
|
30
|
-
return
|
|
31
|
-
responses.filter((r) => !$.httpResponse.isErrorResponse(r))
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
return (
|
|
33
|
+
<For each={responses.filter((r) => !$.httpResponse.isErrorResponse(r))}>
|
|
34
|
+
{({ statusCode, contentType, responseContent, type }) => {
|
|
35
|
+
const body = responseContent.body;
|
|
34
36
|
|
|
35
|
-
|
|
37
|
+
let expression: Children = code`return;`;
|
|
36
38
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
39
|
+
const contentTypeCheck = body
|
|
40
|
+
? ` && response.headers["content-type"]?.includes("${contentType}")`
|
|
41
|
+
: " && !response.body";
|
|
40
42
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
43
|
+
if (body && (body.bodyKind === "single" || (type && !isVoidType(type)))) {
|
|
44
|
+
expression = (
|
|
45
|
+
<ContentTypeEncodingProvider contentType={contentType}>
|
|
46
|
+
return{" "}
|
|
47
|
+
<JsonTransform itemRef={"response.body"} target="application" type={body.type} />
|
|
48
|
+
!;
|
|
49
|
+
</ContentTypeEncodingProvider>
|
|
50
|
+
);
|
|
51
|
+
}
|
|
47
52
|
|
|
48
|
-
|
|
49
|
-
|
|
53
|
+
if ($.httpResponse.statusCode.isSingle(statusCode)) {
|
|
54
|
+
return code`
|
|
50
55
|
if (+response.status === ${statusCode}${contentTypeCheck}) {
|
|
51
56
|
${expression}
|
|
52
57
|
}
|
|
53
58
|
`;
|
|
54
|
-
|
|
59
|
+
}
|
|
55
60
|
|
|
56
|
-
|
|
57
|
-
|
|
61
|
+
if ($.httpResponse.statusCode.isRange(statusCode)) {
|
|
62
|
+
return code`
|
|
58
63
|
if (+response.status >= ${statusCode.start} && +response.status <= ${statusCode.end} ${contentTypeCheck}) {
|
|
59
64
|
${expression}
|
|
60
65
|
}
|
|
61
66
|
`;
|
|
62
|
-
|
|
67
|
+
}
|
|
63
68
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
69
|
+
return null;
|
|
70
|
+
}}
|
|
71
|
+
</For>
|
|
67
72
|
);
|
|
68
73
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { For, refkey } from "@alloy-js/core";
|
|
2
2
|
import * as ts from "@alloy-js/typescript";
|
|
3
3
|
import { $ } from "@typespec/compiler/experimental/typekit";
|
|
4
4
|
import * as ef from "@typespec/emitter-framework/typescript";
|
|
@@ -12,18 +12,22 @@ export interface ModelsProps {
|
|
|
12
12
|
export function Models(props: ModelsProps) {
|
|
13
13
|
const clientLibrary = useClientLibrary();
|
|
14
14
|
const dataTypes = clientLibrary.dataTypes;
|
|
15
|
-
return
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
(type) => {
|
|
19
|
-
if($.model.is(type) && $.model.isHttpFile(type)) {
|
|
20
|
-
return
|
|
21
|
-
{
|
|
22
|
-
|
|
15
|
+
return (
|
|
16
|
+
<ts.SourceFile path={props.path ?? "models.ts"}>
|
|
17
|
+
<For each={dataTypes} joiner={"\n"} hardline>
|
|
18
|
+
{(type) => {
|
|
19
|
+
if ($.model.is(type) && $.model.isHttpFile(type)) {
|
|
20
|
+
return (
|
|
21
|
+
<ts.TypeDeclaration name="File" export kind="type" refkey={refkey(type)}>
|
|
22
|
+
{getFileTypeReference()}
|
|
23
|
+
</ts.TypeDeclaration>
|
|
24
|
+
);
|
|
23
25
|
}
|
|
24
|
-
return $.array.is(type) || $.record.is(type) ? null :
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
return $.array.is(type) || $.record.is(type) ? null : (
|
|
27
|
+
<ef.TypeDeclaration export type={type} />
|
|
28
|
+
);
|
|
29
|
+
}}
|
|
30
|
+
</For>
|
|
31
|
+
</ts.SourceFile>
|
|
32
|
+
);
|
|
29
33
|
}
|
|
@@ -18,9 +18,22 @@ export function OperationOptionsDeclaration(props: OperationOptionsProps) {
|
|
|
18
18
|
(p) => p.property.optional || hasDefaultValue(p),
|
|
19
19
|
);
|
|
20
20
|
|
|
21
|
-
return
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
return (
|
|
22
|
+
<ts.InterfaceDeclaration
|
|
23
|
+
export
|
|
24
|
+
name={interfaceName}
|
|
25
|
+
extends={getOperationOptionsInterfaceRefkey()}
|
|
26
|
+
refkey={getOperationOptionsTypeRefkey(props.operation)}
|
|
27
|
+
>
|
|
28
|
+
<ay.For each={optionalParameters} line>
|
|
29
|
+
{(parameter) => (
|
|
30
|
+
<ts.InterfaceMember
|
|
31
|
+
name={parameter.property.name}
|
|
32
|
+
optional
|
|
33
|
+
type={<ef.TypeExpression type={parameter.property.type} />}
|
|
34
|
+
/>
|
|
35
|
+
)}
|
|
36
|
+
</ay.For>
|
|
37
|
+
</ts.InterfaceDeclaration>
|
|
38
|
+
);
|
|
26
39
|
}
|
|
@@ -2,6 +2,7 @@ import * as ay from "@alloy-js/core";
|
|
|
2
2
|
import * as ts from "@alloy-js/typescript";
|
|
3
3
|
import { TransformNamePolicyContext } from "@typespec/emitter-framework";
|
|
4
4
|
import { ClientLibrary } from "@typespec/http-client/components";
|
|
5
|
+
import { httpParamsMutator } from "../utils/operations.js";
|
|
5
6
|
import { EncodingProvider } from "./encoding-provider.jsx";
|
|
6
7
|
import { httpRuntimeTemplateLib } from "./external-packages/ts-http-runtime.js";
|
|
7
8
|
import { uriTemplateLib } from "./external-packages/uri-template.js";
|
|
@@ -14,13 +15,13 @@ export interface OutputProps {
|
|
|
14
15
|
export function Output(props: OutputProps) {
|
|
15
16
|
const tsNamePolicy = ts.createTSNamePolicy();
|
|
16
17
|
const defaultTransformNamePolicy = createTransformNamePolicy();
|
|
17
|
-
return
|
|
18
|
-
<
|
|
19
|
-
<
|
|
20
|
-
<
|
|
21
|
-
{props.children}
|
|
22
|
-
</
|
|
23
|
-
</
|
|
24
|
-
</
|
|
25
|
-
|
|
18
|
+
return (
|
|
19
|
+
<ay.Output namePolicy={tsNamePolicy} externals={[uriTemplateLib, httpRuntimeTemplateLib]}>
|
|
20
|
+
<ClientLibrary operationMutators={[httpParamsMutator]}>
|
|
21
|
+
<TransformNamePolicyContext.Provider value={defaultTransformNamePolicy}>
|
|
22
|
+
<EncodingProvider>{props.children}</EncodingProvider>
|
|
23
|
+
</TransformNamePolicyContext.Provider>
|
|
24
|
+
</ClientLibrary>
|
|
25
|
+
</ay.Output>
|
|
26
|
+
);
|
|
26
27
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as ts from "@alloy-js/typescript";
|
|
2
|
+
import { $ } from "@typespec/compiler/experimental/typekit";
|
|
2
3
|
import {
|
|
3
4
|
DateDeserializer,
|
|
4
5
|
DateRfc3339Serializer,
|
|
@@ -25,7 +26,8 @@ export function ModelSerializers(props: ModelSerializersProps) {
|
|
|
25
26
|
// Todo: Handle other kinds of serialization, for example XML. Might need to
|
|
26
27
|
// revisit the way we process these and might need to track the relationship
|
|
27
28
|
// between the data type and the operations that consume them.
|
|
28
|
-
return
|
|
29
|
+
return (
|
|
30
|
+
<ts.SourceFile path={props.path ?? "serializers.ts"}>
|
|
29
31
|
<DecodeBase64 />
|
|
30
32
|
<EncodeUint8Array />
|
|
31
33
|
<DateDeserializer />
|
|
@@ -34,14 +36,24 @@ export function ModelSerializers(props: ModelSerializersProps) {
|
|
|
34
36
|
<DateRfc7231Serializer />
|
|
35
37
|
<DateUnixTimestampSerializer />
|
|
36
38
|
<DateUnixTimestampDeserializer />
|
|
37
|
-
{operations.map(o =>
|
|
39
|
+
{operations.map((o) => (
|
|
40
|
+
<TransformDeclaration operation={o} />
|
|
41
|
+
))}
|
|
38
42
|
{dataTypes
|
|
39
43
|
.filter((m) => m.kind === "Model" || m.kind === "Union")
|
|
40
|
-
.map((type) =>
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
44
|
+
.map((type) => {
|
|
45
|
+
let bytesDefaultEncoding: "base64" | "none" = "base64";
|
|
46
|
+
if ($.model.is(type) && type.baseModel && $.model.isHttpFile(type.baseModel)) {
|
|
47
|
+
bytesDefaultEncoding = "none";
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return (
|
|
51
|
+
<EncodingProvider defaults={{ bytes: bytesDefaultEncoding }}>
|
|
52
|
+
<JsonTransformDeclaration type={type} target="transport" />
|
|
53
|
+
<JsonTransformDeclaration type={type} target="application" />
|
|
54
|
+
</EncodingProvider>
|
|
55
|
+
);
|
|
56
|
+
})}
|
|
57
|
+
</ts.SourceFile>
|
|
58
|
+
);
|
|
47
59
|
}
|
|
@@ -9,14 +9,25 @@ export function EncodeUint8Array(): ay.Children {
|
|
|
9
9
|
const valueRef = ay.refkey();
|
|
10
10
|
const encodingRef = ay.refkey();
|
|
11
11
|
const refkey = getEncodeUint8ArrayRef();
|
|
12
|
-
return
|
|
13
|
-
|
|
12
|
+
return (
|
|
13
|
+
<ts.FunctionDeclaration
|
|
14
|
+
export
|
|
15
|
+
refkey={refkey}
|
|
16
|
+
name="encodeUint8Array"
|
|
17
|
+
parameters={{
|
|
18
|
+
value: { type: "Uint8Array | undefined | null", refkey: valueRef },
|
|
19
|
+
encoding: { type: "BufferEncoding", refkey: encodingRef },
|
|
20
|
+
}}
|
|
21
|
+
returnType="string | undefined"
|
|
22
|
+
>
|
|
23
|
+
{ay.code`
|
|
14
24
|
if (!${valueRef}) {
|
|
15
25
|
return ${valueRef} as any;
|
|
16
26
|
}
|
|
17
27
|
return Buffer.from(${valueRef}).toString(${encodingRef});
|
|
18
|
-
`}
|
|
19
|
-
|
|
28
|
+
`}
|
|
29
|
+
</ts.FunctionDeclaration>
|
|
30
|
+
);
|
|
20
31
|
}
|
|
21
32
|
|
|
22
33
|
export function getDecodeUint8ArrayRef(): ay.Refkey {
|
|
@@ -25,8 +36,15 @@ export function getDecodeUint8ArrayRef(): ay.Refkey {
|
|
|
25
36
|
export function DecodeBase64(): ay.Children {
|
|
26
37
|
const refkey = getDecodeUint8ArrayRef();
|
|
27
38
|
const valueRef = ay.refkey();
|
|
28
|
-
return
|
|
29
|
-
|
|
39
|
+
return (
|
|
40
|
+
<ts.FunctionDeclaration
|
|
41
|
+
export
|
|
42
|
+
name="decodeBase64"
|
|
43
|
+
parameters={{ value: { type: "string", refkey: valueRef } }}
|
|
44
|
+
returnType="Uint8Array | undefined"
|
|
45
|
+
refkey={refkey}
|
|
46
|
+
>
|
|
47
|
+
{ay.code`
|
|
30
48
|
if(!${valueRef}) {
|
|
31
49
|
return ${valueRef} as any;
|
|
32
50
|
}
|
|
@@ -36,6 +54,6 @@ export function DecodeBase64(): ay.Children {
|
|
|
36
54
|
|
|
37
55
|
return new Uint8Array(Buffer.from(base64, 'base64'));
|
|
38
56
|
`}
|
|
39
|
-
|
|
40
|
-
|
|
57
|
+
</ts.FunctionDeclaration>
|
|
58
|
+
);
|
|
41
59
|
}
|
|
@@ -10,17 +10,22 @@ export function OperationOptionsInterfaceDeclaration() {
|
|
|
10
10
|
const declarationRefkey = getOperationOptionsInterfaceRefkey();
|
|
11
11
|
const onResponseCallback = ay.code`(rawResponse: ${httpRuntimeTemplateLib.PathUncheckedResponse}) => void`;
|
|
12
12
|
|
|
13
|
-
const operationOptions =
|
|
13
|
+
const operationOptions = (
|
|
14
14
|
<ts.InterfaceExpression>
|
|
15
|
-
|
|
16
|
-
</ts.InterfaceExpression
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
<ts.InterfaceMember name="onResponse" optional type={onResponseCallback} />
|
|
16
|
+
</ts.InterfaceExpression>
|
|
17
|
+
);
|
|
18
|
+
return (
|
|
19
|
+
<ts.InterfaceDeclaration export name="OperationOptions" refkey={declarationRefkey}>
|
|
20
|
+
<ts.InterfaceMember name="operationOptions" optional type={operationOptions} />
|
|
21
|
+
</ts.InterfaceDeclaration>
|
|
22
|
+
);
|
|
20
23
|
}
|
|
21
24
|
|
|
22
25
|
export function Interfaces() {
|
|
23
|
-
return
|
|
24
|
-
<
|
|
25
|
-
|
|
26
|
+
return (
|
|
27
|
+
<ts.SourceFile path="interfaces.ts">
|
|
28
|
+
<OperationOptionsInterfaceDeclaration />
|
|
29
|
+
</ts.SourceFile>
|
|
30
|
+
);
|
|
26
31
|
}
|
|
@@ -15,17 +15,37 @@ export function getFileTypeReference() {
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
export function MultipartHelpers(props: MultipartHelpersProps) {
|
|
18
|
-
return
|
|
19
|
-
<ts.
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
18
|
+
return (
|
|
19
|
+
<ts.SourceFile path="multipart-helpers.ts">
|
|
20
|
+
<ts.InterfaceDeclaration name="File" export refkey={getFileTypeReference()}>
|
|
21
|
+
contents: {getFileContentsTypeReference()}; contentType?: string; filename?: string;
|
|
22
|
+
</ts.InterfaceDeclaration>
|
|
23
|
+
<ts.TypeDeclaration
|
|
24
|
+
name="FileContents"
|
|
25
|
+
export
|
|
26
|
+
kind="type"
|
|
27
|
+
refkey={getFileContentsTypeReference()}
|
|
28
|
+
>
|
|
29
|
+
{ay.mapJoin(
|
|
30
|
+
() => [
|
|
31
|
+
"string",
|
|
32
|
+
"NodeJS.ReadableStream",
|
|
33
|
+
"ReadableStream<Uint8Array>",
|
|
34
|
+
"Uint8Array",
|
|
35
|
+
"Blob",
|
|
36
|
+
],
|
|
37
|
+
(t) => t,
|
|
38
|
+
{ joiner: " | " },
|
|
39
|
+
)}
|
|
40
|
+
</ts.TypeDeclaration>
|
|
41
|
+
<ts.FunctionDeclaration
|
|
42
|
+
name="createFilePartDescriptor"
|
|
43
|
+
parameters={getCreateFilePartParameters()}
|
|
44
|
+
export
|
|
45
|
+
returnType="any"
|
|
46
|
+
refkey={getCreateFilePartDescriptorReference()}
|
|
47
|
+
>
|
|
48
|
+
{ay.code`
|
|
29
49
|
if (fileInput.contents) {
|
|
30
50
|
return {
|
|
31
51
|
name: partName,
|
|
@@ -41,8 +61,9 @@ export function MultipartHelpers(props: MultipartHelpersProps) {
|
|
|
41
61
|
};
|
|
42
62
|
}
|
|
43
63
|
`}
|
|
44
|
-
|
|
45
|
-
|
|
64
|
+
</ts.FunctionDeclaration>
|
|
65
|
+
</ts.SourceFile>
|
|
66
|
+
);
|
|
46
67
|
}
|
|
47
68
|
|
|
48
69
|
function getCreateFilePartParameters() {
|
|
@@ -19,16 +19,39 @@ export function RestError() {
|
|
|
19
19
|
const constructorRefkey = ay.refkey("constructor", "rest-error-class-method");
|
|
20
20
|
const fromHttpResponseRefkey = ay.refkey("from-http-response", "rest-error-class-method");
|
|
21
21
|
|
|
22
|
-
const restErrorClass =
|
|
22
|
+
const restErrorClass = (
|
|
23
23
|
<ts.ClassDeclaration export name="RestError" extends="Error" refkey={getRestErrorRefkey()}>
|
|
24
|
-
<
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
24
|
+
<ay.StatementList>
|
|
25
|
+
<ts.ClassField
|
|
26
|
+
public
|
|
27
|
+
name="request"
|
|
28
|
+
type={httpRuntimeTemplateLib.PipelineRequest}
|
|
29
|
+
refkey={requestRefkey}
|
|
30
|
+
/>
|
|
31
|
+
<ts.ClassField
|
|
32
|
+
public
|
|
33
|
+
name="response"
|
|
34
|
+
type={httpRuntimeTemplateLib.HttpResponse}
|
|
35
|
+
refkey={responseRefkey}
|
|
36
|
+
/>
|
|
37
|
+
<ts.ClassField public name="status" type="string" refkey={statusRefkey} />
|
|
38
|
+
<ts.ClassField public name="body" type="any" refkey={bodyRefkey} />
|
|
39
|
+
<ts.ClassField
|
|
40
|
+
public
|
|
41
|
+
name="headers"
|
|
42
|
+
type={httpRuntimeTemplateLib.RawHttpHeaders}
|
|
43
|
+
refkey={headersRefkey}
|
|
44
|
+
/>
|
|
45
|
+
</ay.StatementList>
|
|
46
|
+
|
|
47
|
+
<ay.List hardline>
|
|
48
|
+
<ts.ClassMethod
|
|
49
|
+
name="constructor"
|
|
50
|
+
parameters={{ message: "string", response: httpRuntimeTemplateLib.HttpResponse }}
|
|
51
|
+
returnType={null}
|
|
52
|
+
refkey={constructorRefkey}
|
|
53
|
+
>
|
|
54
|
+
{ay.code`
|
|
32
55
|
// Create an error message that includes relevant details.
|
|
33
56
|
super(\`$\{message\} - HTTP $\{response.status} received for $\{response.request.method} $\{response.request.url}\`);
|
|
34
57
|
this.name = 'RestError';
|
|
@@ -41,21 +64,36 @@ export function RestError() {
|
|
|
41
64
|
// Set the prototype explicitly.
|
|
42
65
|
Object.setPrototypeOf(this, RestError.prototype);
|
|
43
66
|
`}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
67
|
+
</ts.ClassMethod>
|
|
68
|
+
<ts.ClassMethod
|
|
69
|
+
static
|
|
70
|
+
name="fromHttpResponse"
|
|
71
|
+
parameters={{ response: httpRuntimeTemplateLib.HttpResponse }}
|
|
72
|
+
returnType={getRestErrorRefkey()}
|
|
73
|
+
refkey={fromHttpResponseRefkey}
|
|
74
|
+
>
|
|
75
|
+
{ay.code`
|
|
47
76
|
const defaultMessage = \`Unexpected HTTP status code: $\{response.status}\`;
|
|
48
77
|
return new RestError(defaultMessage, response);
|
|
49
78
|
`}
|
|
50
|
-
|
|
51
|
-
|
|
79
|
+
</ts.ClassMethod>
|
|
80
|
+
</ay.List>
|
|
81
|
+
</ts.ClassDeclaration>
|
|
82
|
+
);
|
|
52
83
|
|
|
53
|
-
const createRestError =
|
|
54
|
-
<ts.FunctionDeclaration
|
|
55
|
-
|
|
84
|
+
const createRestError = (
|
|
85
|
+
<ts.FunctionDeclaration
|
|
86
|
+
export
|
|
87
|
+
name="createRestError"
|
|
88
|
+
parameters={{ response: httpRuntimeTemplateLib.HttpResponse }}
|
|
89
|
+
returnType={getRestErrorRefkey()}
|
|
90
|
+
refkey={getCreateRestErrorRefkey()}
|
|
91
|
+
>
|
|
92
|
+
{ay.code`
|
|
56
93
|
return ${fromHttpResponseRefkey}(response);
|
|
57
94
|
`}
|
|
58
|
-
|
|
95
|
+
</ts.FunctionDeclaration>
|
|
96
|
+
);
|
|
59
97
|
|
|
60
98
|
return [restErrorClass, "\n\n", createRestError];
|
|
61
99
|
}
|