@typespec/http-client-js 0.4.0-dev.1 → 0.4.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/CHANGELOG.md +0 -1
- package/dist/src/components/client-context/client-context-factory.js +1 -1
- package/dist/src/components/client-context/client-context-factory.js.map +1 -1
- package/dist/src/components/client-operation.d.ts +4 -1
- package/dist/src/components/client-operation.d.ts.map +1 -1
- package/dist/src/components/client-operation.js +68 -38
- package/dist/src/components/client-operation.js.map +1 -1
- package/dist/src/components/client.d.ts.map +1 -1
- package/dist/src/components/client.js +7 -4
- package/dist/src/components/client.js.map +1 -1
- package/dist/src/components/http-request-options.d.ts +5 -5
- package/dist/src/components/http-request-options.d.ts.map +1 -1
- package/dist/src/components/http-request-options.js +12 -12
- package/dist/src/components/http-request-options.js.map +1 -1
- package/dist/src/components/http-request-parameters-expression.d.ts +2 -1
- package/dist/src/components/http-request-parameters-expression.d.ts.map +1 -1
- package/dist/src/components/http-request-parameters-expression.js +125 -18
- package/dist/src/components/http-request-parameters-expression.js.map +1 -1
- package/dist/src/components/http-request.d.ts +3 -3
- package/dist/src/components/http-request.d.ts.map +1 -1
- package/dist/src/components/http-request.js +35 -30
- package/dist/src/components/http-request.js.map +1 -1
- package/dist/src/components/http-response.d.ts +3 -3
- package/dist/src/components/http-response.d.ts.map +1 -1
- package/dist/src/components/http-response.js +11 -6
- package/dist/src/components/http-response.js.map +1 -1
- package/dist/src/components/operation-handlers/index.d.ts +3 -0
- package/dist/src/components/operation-handlers/index.d.ts.map +1 -0
- package/dist/src/components/operation-handlers/index.js +3 -0
- package/dist/src/components/operation-handlers/index.js.map +1 -0
- package/dist/src/components/operation-handlers/operation-pipeline.d.ts +15 -0
- package/dist/src/components/operation-handlers/operation-pipeline.d.ts.map +1 -0
- package/dist/src/components/operation-handlers/operation-pipeline.js +28 -0
- package/dist/src/components/operation-handlers/operation-pipeline.js.map +1 -0
- package/dist/src/components/operation-handlers/paging/page-item.d.ts +3 -0
- package/dist/src/components/operation-handlers/paging/page-item.d.ts.map +1 -0
- package/dist/src/components/operation-handlers/paging/page-item.js +17 -0
- package/dist/src/components/operation-handlers/paging/page-item.js.map +1 -0
- package/dist/src/components/operation-handlers/paging/page-response.d.ts +10 -0
- package/dist/src/components/operation-handlers/paging/page-response.d.ts.map +1 -0
- package/dist/src/components/operation-handlers/paging/page-response.js +50 -0
- package/dist/src/components/operation-handlers/paging/page-response.js.map +1 -0
- package/dist/src/components/operation-handlers/paging/page-settings.d.ts +11 -0
- package/dist/src/components/operation-handlers/paging/page-settings.d.ts.map +1 -0
- package/dist/src/components/operation-handlers/paging/page-settings.js +52 -0
- package/dist/src/components/operation-handlers/paging/page-settings.js.map +1 -0
- package/dist/src/components/operation-handlers/paging/paginated-operation-handler.d.ts +3 -0
- package/dist/src/components/operation-handlers/paging/paginated-operation-handler.d.ts.map +1 -0
- package/dist/src/components/operation-handlers/paging/paginated-operation-handler.js +170 -0
- package/dist/src/components/operation-handlers/paging/paginated-operation-handler.js.map +1 -0
- package/dist/src/components/operation-handlers/paging/request-send.d.ts +12 -0
- package/dist/src/components/operation-handlers/paging/request-send.d.ts.map +1 -0
- package/dist/src/components/operation-handlers/paging/request-send.js +78 -0
- package/dist/src/components/operation-handlers/paging/request-send.js.map +1 -0
- package/dist/src/components/operation-handlers/paging/response-deserialize.d.ts +11 -0
- package/dist/src/components/operation-handlers/paging/response-deserialize.d.ts.map +1 -0
- package/dist/src/components/operation-handlers/paging/response-deserialize.js +51 -0
- package/dist/src/components/operation-handlers/paging/response-deserialize.js.map +1 -0
- package/dist/src/components/operation-handlers/paging/util.d.ts +17 -0
- package/dist/src/components/operation-handlers/paging/util.d.ts.map +1 -0
- package/dist/src/components/operation-handlers/paging/util.js +46 -0
- package/dist/src/components/operation-handlers/paging/util.js.map +1 -0
- package/dist/src/components/operation-handlers/types.d.ts +16 -0
- package/dist/src/components/operation-handlers/types.d.ts.map +1 -0
- package/dist/src/components/operation-handlers/types.js +1 -0
- package/dist/src/components/operation-handlers/types.js.map +1 -0
- package/dist/src/components/operation-options.d.ts +2 -0
- package/dist/src/components/operation-options.d.ts.map +1 -1
- package/dist/src/components/operation-options.js +2 -1
- package/dist/src/components/operation-options.js.map +1 -1
- package/dist/src/components/operation-parameters.d.ts +1 -1
- package/dist/src/components/operation-parameters.d.ts.map +1 -1
- package/dist/src/components/operation-parameters.js +7 -5
- package/dist/src/components/operation-parameters.js.map +1 -1
- package/dist/src/components/output.d.ts.map +1 -1
- package/dist/src/components/output.js +4 -0
- package/dist/src/components/output.js.map +1 -1
- package/dist/src/components/static-helpers/bytes-encoding.js +14 -16
- package/dist/src/components/static-helpers/bytes-encoding.js.map +1 -1
- package/dist/src/components/static-helpers/multipart-helpers.js +12 -10
- package/dist/src/components/static-helpers/multipart-helpers.js.map +1 -1
- package/dist/src/components/static-helpers/paging-helper.d.ts +5 -0
- package/dist/src/components/static-helpers/paging-helper.d.ts.map +1 -0
- package/dist/src/components/static-helpers/paging-helper.js +197 -0
- package/dist/src/components/static-helpers/paging-helper.js.map +1 -0
- package/dist/src/components/static-helpers/rest-error.d.ts.map +1 -1
- package/dist/src/components/static-helpers/rest-error.js +15 -10
- package/dist/src/components/static-helpers/rest-error.js.map +1 -1
- package/dist/src/components/testing/client-options.d.ts +1 -1
- package/dist/src/components/testing/client-options.d.ts.map +1 -1
- package/dist/src/components/transforms/json/json-array-transform.d.ts +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 +6 -7
- package/dist/src/components/transforms/json/json-array-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 +15 -2
- package/dist/src/components/transforms/json/json-model-property-transform.js.map +1 -1
- package/dist/src/components/transforms/json/json-model-transform.js +8 -8
- package/dist/src/components/transforms/json/json-model-transform.js.map +1 -1
- package/dist/src/components/transforms/json/json-record-transform.d.ts +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 +6 -7
- package/dist/src/components/transforms/json/json-record-transform.js.map +1 -1
- package/dist/src/components/transforms/json/json-transform-discriminator.js +6 -7
- package/dist/src/components/transforms/json/json-transform-discriminator.js.map +1 -1
- package/dist/src/components/transforms/json/union-transform.js +6 -7
- package/dist/src/components/transforms/json/union-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 -3
- package/dist/src/components/transforms/operation-transform-declaration.js.map +1 -1
- package/dist/src/components/transforms/operation-transform-expression.d.ts +2 -2
- package/dist/src/components/transforms/operation-transform-expression.d.ts.map +1 -1
- package/dist/src/components/transforms/operation-transform-expression.js +1 -1
- package/dist/src/components/transforms/operation-transform-expression.js.map +1 -1
- package/dist/src/emitter.d.ts.map +1 -1
- package/dist/src/emitter.js +2 -1
- package/dist/src/emitter.js.map +1 -1
- package/dist/src/lib.d.ts +17 -2
- package/dist/src/lib.d.ts.map +1 -1
- package/dist/src/lib.js +6 -0
- package/dist/src/lib.js.map +1 -1
- package/dist/src/utils/parameters.d.ts +1 -1
- package/dist/src/utils/parameters.d.ts.map +1 -1
- package/dist/src/utils/parameters.js +13 -12
- package/dist/src/utils/parameters.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -4
- package/src/components/client-context/client-context-factory.tsx +1 -1
- package/src/components/client-operation.tsx +40 -16
- package/src/components/client.tsx +8 -10
- package/src/components/http-request-options.tsx +17 -13
- package/src/components/http-request-parameters-expression.tsx +142 -18
- package/src/components/http-request.tsx +22 -20
- package/src/components/http-response.tsx +8 -9
- package/src/components/operation-handlers/index.tsx +2 -0
- package/src/components/operation-handlers/operation-pipeline.tsx +33 -0
- package/src/components/operation-handlers/paging/page-item.tsx +13 -0
- package/src/components/operation-handlers/paging/page-response.tsx +55 -0
- package/src/components/operation-handlers/paging/page-settings.tsx +53 -0
- package/src/components/operation-handlers/paging/paginated-operation-handler.tsx +192 -0
- package/src/components/operation-handlers/paging/request-send.tsx +70 -0
- package/src/components/operation-handlers/paging/response-deserialize.tsx +54 -0
- package/src/components/operation-handlers/paging/util.ts +70 -0
- package/src/components/operation-handlers/types.tsx +18 -0
- package/src/components/operation-options.tsx +6 -3
- package/src/components/operation-parameters.tsx +9 -8
- package/src/components/output.tsx +2 -1
- package/src/components/static-helpers/bytes-encoding.tsx +5 -5
- package/src/components/static-helpers/multipart-helpers.tsx +7 -7
- package/src/components/static-helpers/paging-helper.tsx +195 -0
- package/src/components/static-helpers/rest-error.tsx +6 -3
- package/src/components/transforms/json/json-array-transform.tsx +3 -3
- package/src/components/transforms/json/json-model-property-transform.tsx +13 -1
- package/src/components/transforms/json/json-model-transform.tsx +3 -3
- package/src/components/transforms/json/json-record-transform.tsx +3 -3
- package/src/components/transforms/json/json-transform-discriminator.tsx +3 -3
- package/src/components/transforms/json/union-transform.tsx +3 -3
- package/src/components/transforms/operation-transform-declaration.tsx +2 -1
- package/src/components/transforms/operation-transform-expression.tsx +3 -3
- package/src/emitter.tsx +2 -0
- package/src/lib.ts +6 -0
- package/src/utils/parameters.tsx +23 -25
- package/test/e2e/http/payload/pageable/main.test.ts +78 -22
- package/test/scenarios/encoding/header_bytes.md +1 -1
- package/test/scenarios/encoding/header_date.md +1 -1
- package/test/scenarios/encoding/query_date.md +1 -1
- package/test/scenarios/http-operations/paging.md +244 -0
- package/test/scenarios/http-operations/query-parameter.md +1 -1
- package/test/scenarios/operation-parameters/body_root_anonymous.md +1 -1
- package/test/scenarios/operation-parameters/with_body_property.md +1 -1
- package/test/scenarios/operation-parameters/with_body_root.md +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http-request-parameters-expression.js","names":["ay","ts","useTransformNamePolicy","getDefaultValue","JsonTransform","HttpRequestParametersExpression","props","parameters","transformNamer","children","Array","isArray","length","push","_$memo","_$createComponent","ObjectExpression","optionsParamRef","optionsParameter","members","For","each","line","comma","httpProperty","
|
|
1
|
+
{"version":3,"file":"http-request-parameters-expression.js","names":["ay","ts","useTransformNamePolicy","getDefaultValue","hasDefaultValue","JsonTransform","HttpRequestParametersExpression","props","parameters","transformNamer","children","Array","isArray","length","push","_$memo","_$createComponent","ObjectExpression","optionsParamRef","optionsParameter","members","For","each","line","comma","httpProperty","defaultValue","propertyExpression","buildMemberChainExpression","httpOperation","transportParamName","getTransportName","property","paramValue","fullExpression","NamePolicyContext","Provider","value","getName","n","ObjectProperty","name","isNullish","code","itemRef","leadingExpression","type","target","segments","optional","namePolicy","useNamePolicy","propertyApplicationName","path","propertyName","currentPath","slice","parentProperty","findHttpPropertyByPath","joiner","parentName","unshift","isValidIdentifier","JSON","stringify","List","test","properties","undefined"],"sources":["../../../src/components/http-request-parameters-expression.tsx"],"sourcesContent":[null],"mappings":";;AAAA,OAAO,KAAKA,EAAE,MAAM,gBAAgB;AACpC,OAAO,KAAKC,EAAE,MAAM,sBAAsB;AAC1C,SAASC,sBAAsB,QAAQ,6BAA6B;AAEpE,SAASC,eAAe,EAAEC,eAAe;AACzC,SAASC,aAAa;AAQtB,OAAO,SAASC,+BAA+BA,CAACC,KAA2C,EAAE;EAC3F,MAAMC,UAAyB,GAAG,EAAE;EACpC,MAAMC,cAAc,GAAGP,sBAAsB,CAAC,CAAC;EAE/C,IAAIK,KAAK,CAACG,QAAQ,IAAKC,KAAK,CAACC,OAAO,CAACL,KAAK,CAACG,QAAQ,CAAC,IAAIH,KAAK,CAACG,QAAQ,CAACG,MAAO,EAAE;IAC9EL,UAAU,CAACM,IAAI,EAAAC,MAAA,OAAIR,KAAK,CAACG,QAAQ,OAAK,CAAC;EACzC;EAEA,IAAI,CAACH,KAAK,CAACC,UAAU,IAAIA,UAAU,CAACK,MAAM,EAAE;IAC1C,OAAAG,iBAAA,CAAQf,EAAE,CAACgB,gBAAgB;MAAAP,QAAA,EAAEF;IAAU;E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CAACQ,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAAA;EAAA,EAAI;EAEtE,OAAO;IACLF,YAAY,EAAEF,uBAAuB;IACrCV,SAAS;IACTR,cAAc;IACdW;EACF,CAAC;AACH;AAEA,SAASiB,iBAAiBA,CAACrB,IAAY,EAAW;EAChD,OAAO,4BAA4B,CAACyB,IAAI,CAACzB,IAAI,CAAC;AAChD;AAEA,SAASiB,sBAAsBA,CAC7B7B,aAA4B,EAC5BwB,IAAyB,EACC;EAC1B,KAAK,MAAMrB,QAAQ,IAAIH,aAAa,CAACrB,UAAU,CAAC2D,UAAU,EAAE;IAC1D;IACA,IAAIJ,IAAI,CAACC,SAAS,CAAChC,QAAQ,CAACqB,IAAI,CAAC,KAAKU,IAAI,CAACC,SAAS,CAACX,IAAI,CAAC,EAAE;MAC1D,OAAOrB,QAAQ;IACjB;EACF;EACA,OAAOoC,SAAS;AAClB","ignoreList":[]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Children, Refkey } from "@alloy-js/core";
|
|
2
|
-
import {
|
|
2
|
+
import { HttpOperation } from "@typespec/http";
|
|
3
3
|
export interface HttpRequestProps {
|
|
4
|
-
|
|
4
|
+
httpOperation: HttpOperation;
|
|
5
5
|
responseRefkey?: Refkey;
|
|
6
6
|
}
|
|
7
7
|
export declare function HttpRequest(props: HttpRequestProps): Children;
|
|
@@ -9,7 +9,7 @@ export declare namespace HttpRequest {
|
|
|
9
9
|
var Url: (props: HttpUrlProps) => Children;
|
|
10
10
|
}
|
|
11
11
|
export interface HttpUrlProps {
|
|
12
|
-
|
|
12
|
+
httpOperation: HttpOperation;
|
|
13
13
|
refkey?: Refkey;
|
|
14
14
|
children?: Children;
|
|
15
15
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http-request.d.ts","sourceRoot":"","sources":["../../../src/components/http-request.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,
|
|
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,6 +1,7 @@
|
|
|
1
|
+
import { createIntrinsic as _$createIntrinsic } from "@alloy-js/core/jsx-runtime";
|
|
1
2
|
import { memo as _$memo } from "@alloy-js/core/jsx-runtime";
|
|
2
3
|
import { createComponent as _$createComponent } from "@alloy-js/core/jsx-runtime";
|
|
3
|
-
import { code, refkey, StatementList } from "@alloy-js/core";
|
|
4
|
+
import { code, List, refkey, StatementList } from "@alloy-js/core";
|
|
4
5
|
import * as ts from "@alloy-js/typescript";
|
|
5
6
|
import { Reference } from "@alloy-js/typescript";
|
|
6
7
|
import { EncodingProvider } from "./encoding-provider.js";
|
|
@@ -12,45 +13,46 @@ export function HttpRequest(props) {
|
|
|
12
13
|
const operationUrlRefkey = refkey();
|
|
13
14
|
const requestOptionsRefkey = refkey();
|
|
14
15
|
const httpResponseRefkey = props.responseRefkey ?? refkey();
|
|
15
|
-
const verb = props.
|
|
16
|
-
return _$createComponent(
|
|
16
|
+
const verb = props.httpOperation.verb;
|
|
17
|
+
return _$createComponent(List, {
|
|
17
18
|
get children() {
|
|
18
|
-
return [_$createComponent(
|
|
19
|
-
get operation() {
|
|
20
|
-
return props.operation;
|
|
21
|
-
},
|
|
22
|
-
refkey: operationUrlRefkey
|
|
23
|
-
}), _$createComponent(HttpRequestOptions, {
|
|
24
|
-
get operation() {
|
|
25
|
-
return props.operation;
|
|
26
|
-
},
|
|
27
|
-
refkey: requestOptionsRefkey
|
|
28
|
-
}), _$createComponent(ts.VarDeclaration, {
|
|
29
|
-
name: "response",
|
|
30
|
-
refkey: httpResponseRefkey,
|
|
19
|
+
return [_$createComponent(StatementList, {
|
|
31
20
|
get children() {
|
|
32
|
-
return
|
|
33
|
-
|
|
21
|
+
return [_$createComponent(HttpRequest.Url, {
|
|
22
|
+
get httpOperation() {
|
|
23
|
+
return props.httpOperation;
|
|
24
|
+
},
|
|
34
25
|
refkey: operationUrlRefkey
|
|
35
|
-
})
|
|
26
|
+
}), _$createComponent(HttpRequestOptions, {
|
|
27
|
+
get httpOperation() {
|
|
28
|
+
return props.httpOperation;
|
|
29
|
+
},
|
|
36
30
|
refkey: requestOptionsRefkey
|
|
37
|
-
})
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
31
|
+
}), _$createComponent(ts.VarDeclaration, {
|
|
32
|
+
name: "response",
|
|
33
|
+
refkey: httpResponseRefkey,
|
|
34
|
+
get children() {
|
|
35
|
+
return code`
|
|
36
|
+
await client.pathUnchecked(${_$createComponent(Reference, {
|
|
37
|
+
refkey: operationUrlRefkey
|
|
38
|
+
})}).${verb}(${_$createComponent(Reference, {
|
|
39
|
+
refkey: requestOptionsRefkey
|
|
40
|
+
})})
|
|
43
41
|
`;
|
|
42
|
+
}
|
|
43
|
+
}), _$createIntrinsic("hbr", {})];
|
|
44
44
|
}
|
|
45
|
-
})
|
|
45
|
+
}), code`
|
|
46
|
+
if (typeof options?.operationOptions?.onResponse === "function") {
|
|
47
|
+
options?.operationOptions?.onResponse(response);
|
|
48
|
+
}`];
|
|
46
49
|
}
|
|
47
50
|
});
|
|
48
51
|
}
|
|
49
52
|
HttpRequest.Url = function HttpUrlDeclaration(props) {
|
|
50
|
-
const
|
|
51
|
-
const
|
|
52
|
-
const
|
|
53
|
-
const optionsParameter = getOperationOptionsParameterRefkey(props.operation.httpOperation);
|
|
53
|
+
const urlTemplate = props.httpOperation.uriTemplate;
|
|
54
|
+
const urlParameters = props.httpOperation.parameters.properties.filter(p => p.kind === "path" || p.kind === "query");
|
|
55
|
+
const optionsParameter = getOperationOptionsParameterRefkey(props.httpOperation);
|
|
54
56
|
return _$createComponent(EncodingProvider, {
|
|
55
57
|
defaults: {
|
|
56
58
|
bytes: "base64url"
|
|
@@ -63,6 +65,9 @@ HttpRequest.Url = function HttpUrlDeclaration(props) {
|
|
|
63
65
|
},
|
|
64
66
|
get children() {
|
|
65
67
|
return [_$memo(() => uriTemplateLib.parse), "(", _$memo(() => JSON.stringify(urlTemplate)), ").expand(", _$memo(() => _$createComponent(HttpRequestParametersExpression, {
|
|
68
|
+
get httpOperation() {
|
|
69
|
+
return props.httpOperation;
|
|
70
|
+
},
|
|
66
71
|
optionsParameter: optionsParameter,
|
|
67
72
|
parameters: urlParameters
|
|
68
73
|
})), ")"];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http-request.js","names":["code","refkey","StatementList","ts","Reference","EncodingProvider","uriTemplateLib","HttpRequestOptions","HttpRequestParametersExpression","getOperationOptionsParameterRefkey","HttpRequest","props","operationUrlRefkey","requestOptionsRefkey","httpResponseRefkey","responseRefkey","verb","
|
|
1
|
+
{"version":3,"file":"http-request.js","names":["code","List","refkey","StatementList","ts","Reference","EncodingProvider","uriTemplateLib","HttpRequestOptions","HttpRequestParametersExpression","getOperationOptionsParameterRefkey","HttpRequest","props","operationUrlRefkey","requestOptionsRefkey","httpResponseRefkey","responseRefkey","verb","httpOperation","_$createComponent","children","Url","VarDeclaration","name","_$createIntrinsic","HttpUrlDeclaration","urlTemplate","uriTemplate","urlParameters","parameters","properties","filter","p","kind","optionsParameter","defaults","bytes","_$memo","parse","JSON","stringify"],"sources":["../../../src/components/http-request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YAAA;UAAA,IAAAU,iBAAA;QAAA;MAAA,IAIAxB,IAAI;AACX;AACA;AACA,QAAQ;IAAA;EAAA;AAGR;AAQAW,WAAW,CAACU,GAAG,GAAG,SAASI,kBAAkBA,CAACb,KAAmB,EAAE;EACjE,MAAMc,WAAW,GAAGd,KAAK,CAACM,aAAa,CAACS,WAAW;EACnD,MAAMC,aAAa,GAAGhB,KAAK,CAACM,aAAa,CAACW,UAAU,CAACC,UAAU,CAACC,MAAM,CACnEC,CAAC,IAAKA,CAAC,CAACC,IAAI,KAAK,MAAM,IAAID,CAAC,CAACC,IAAI,KAAK,OACzC,CAAC;EACD,MAAMC,gBAAgB,GAAGxB,kCAAkC,CAACE,KAAK,CAACM,aAAa,CAAC;EAChF,OAAAC,iBAAA,CACGb,gBAAgB;IAAC6B,QAAQ,EAAE;MAAEC,KAAK,EAAE;IAAY,CAAC;IAAA,IAAAhB,SAAA;MAAA,OAAAD,iBAAA,CAC/Cf,EAAE,CAACkB,cAAc;QAACC,IAAI;QAAA,IAAQrB,MAAMA,CAAA;UAAA,OAAEU,KAAK,CAACV,MAAM;QAAA;QAAA,IAAAkB,SAAA;UAAA,QAAAiB,MAAA,OAChD9B,cAAc,CAAC+B,KAAK,QAAAD,MAAA,OAAGE,IAAI,CAACC,SAAS,CAACd,WAAW,CAAC,gBAAAW,MAAA,OAAAlB,iBAAA,CAEhDV,+BAA+B;YAAA,IAC9BS,aAAaA,CAAA;cAAA,OAAEN,KAAK,CAACM,aAAa;YAAA;YAClCgB,gBAAgB,EAAEA,gBAAgB;YAClCL,UAAU,EAAED;UAAa;QAAA;MAAA;IAAA;EAAA;AAOrC,CAAC","ignoreList":[]}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { Children, Refkey } from "@alloy-js/core";
|
|
2
|
-
import {
|
|
2
|
+
import { HttpOperation } from "@typespec/http";
|
|
3
3
|
export interface HttpResponseProps {
|
|
4
|
-
|
|
4
|
+
httpOperation: HttpOperation;
|
|
5
5
|
responseRefkey: Refkey;
|
|
6
6
|
children?: Children;
|
|
7
7
|
}
|
|
8
8
|
export declare function HttpResponse(props: HttpResponseProps): Children;
|
|
9
9
|
export interface HttpResponsesProps {
|
|
10
|
-
|
|
10
|
+
httpOperation: HttpOperation;
|
|
11
11
|
children?: Children;
|
|
12
12
|
}
|
|
13
13
|
export declare function HttpResponses(props: HttpResponsesProps): Children;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http-response.d.ts","sourceRoot":"","sources":["../../../src/components/http-response.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,
|
|
1
|
+
{"version":3,"file":"http-response.d.ts","sourceRoot":"","sources":["../../../src/components/http-response.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAmB,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAGnE,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAI/C,MAAM,WAAW,iBAAiB;IAChC,aAAa,EAAE,aAAa,CAAC;IAC7B,cAAc,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,YAOpD;AAED,MAAM,WAAW,kBAAkB;IACjC,aAAa,EAAE,aAAa,CAAC;IAC7B,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,YA4CtD"}
|
|
@@ -1,21 +1,26 @@
|
|
|
1
1
|
import { memo as _$memo } from "@alloy-js/core/jsx-runtime";
|
|
2
2
|
import { createComponent as _$createComponent } from "@alloy-js/core/jsx-runtime";
|
|
3
|
-
import { code, For } from "@alloy-js/core";
|
|
3
|
+
import { code, For, List } from "@alloy-js/core";
|
|
4
4
|
import { isVoidType } from "@typespec/compiler";
|
|
5
5
|
import { $ } from "@typespec/compiler/experimental/typekit";
|
|
6
6
|
import { getCreateRestErrorRefkey } from "./static-helpers/rest-error.js";
|
|
7
7
|
import { ContentTypeEncodingProvider } from "./transforms/content-type-encoding-provider.js";
|
|
8
8
|
import { JsonTransform } from "./transforms/json/json-transform.js";
|
|
9
9
|
export function HttpResponse(props) {
|
|
10
|
-
return
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
return _$createComponent(List, {
|
|
11
|
+
hardline: true,
|
|
12
|
+
get children() {
|
|
13
|
+
return [_$createComponent(HttpResponses, {
|
|
14
|
+
get httpOperation() {
|
|
15
|
+
return props.httpOperation;
|
|
16
|
+
}
|
|
17
|
+
}), _$memo(() => code`throw ${getCreateRestErrorRefkey()}(response);`)];
|
|
13
18
|
}
|
|
14
|
-
})
|
|
19
|
+
});
|
|
15
20
|
}
|
|
16
21
|
export function HttpResponses(props) {
|
|
17
22
|
// Handle response by status code and content type
|
|
18
|
-
const responses = $.httpOperation.flattenResponses(props.
|
|
23
|
+
const responses = $.httpOperation.flattenResponses(props.httpOperation);
|
|
19
24
|
return _$createComponent(For, {
|
|
20
25
|
get each() {
|
|
21
26
|
return responses.filter(r => !$.httpResponse.isErrorResponse(r));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http-response.js","names":["code","For","isVoidType","$","getCreateRestErrorRefkey","ContentTypeEncodingProvider","JsonTransform","HttpResponse","props","_$createComponent","HttpResponses","
|
|
1
|
+
{"version":3,"file":"http-response.js","names":["code","For","List","isVoidType","$","getCreateRestErrorRefkey","ContentTypeEncodingProvider","JsonTransform","HttpResponse","props","_$createComponent","hardline","children","HttpResponses","httpOperation","_$memo","responses","flattenResponses","each","filter","r","httpResponse","isErrorResponse","statusCode","contentType","responseContent","type","body","expression","contentTypeCheck","bodyKind","itemRef","target","isSingle","isRange","start","end"],"sources":["../../../src/components/http-response.tsx"],"sourcesContent":[null],"mappings":";;AAAA,SAAmBA,IAAI,EAAEC,GAAG,EAAEC,IAAI,QAAgB,gBAAgB;AAClE,SAASC,UAAU,QAAQ,oBAAoB;AAC/C,SAASC,C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Ae;cAAEC,MAAM;cAAA,IAAeN,IAAIA,CAAA;gBAAA,OAAEC,IAAI,CAACD,IAAI;cAAA;YAAA;UAAA;QAAA,EAGhF;MACH;MAEA,IAAItB,CAAC,CAACiB,YAAY,CAACE,UAAU,CAACU,QAAQ,CAACV,UAAU,CAAC,EAAE;QAClD,OAAOvB,IAAI;AACrB,iCAAiCuB,UAAU,GAAGM,gBAAgB;AAC9D,UAAUD,UAAU;AACpB;AACA,OAAO;MACC;MAEA,IAAIxB,CAAC,CAACiB,YAAY,CAACE,UAAU,CAACW,OAAO,CAACX,UAAU,CAAC,EAAE;QACjD,OAAOvB,IAAI;AACrB,gCAAgCuB,UAAU,CAACY,KAAK,2BAA2BZ,UAAU,CAACa,GAAG,IAAIP,gBAAgB;AAC7G,UAAUD,UAAU;AACpB;AACA,OAAO;MACC;MAEA,OAAO,IAAI;IACb;EAAC;AAGP","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/operation-handlers/index.tsx"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,aAAa,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../src/components/operation-handlers/index.tsx"],"sourcesContent":[null],"mappings":"AAAA;AACA","ignoreList":[]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as ay from "@alloy-js/core";
|
|
2
|
+
import { HttpOperation } from "@typespec/http";
|
|
3
|
+
import { OperationHandlerPipeline } from "./types.jsx";
|
|
4
|
+
export interface OperationPipelineProps {
|
|
5
|
+
httpOperation: HttpOperation;
|
|
6
|
+
pipeline: OperationHandlerPipeline;
|
|
7
|
+
internal?: boolean;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Component that manages the operation handler pipeline.
|
|
11
|
+
* It will try each handler in order until it finds one that can handle the operation.
|
|
12
|
+
* If no handler is found, it will use the default ClientOperation component.
|
|
13
|
+
*/
|
|
14
|
+
export declare function OperationPipeline({ httpOperation, pipeline, internal }: OperationPipelineProps): ay.Children;
|
|
15
|
+
//# sourceMappingURL=operation-pipeline.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operation-pipeline.d.ts","sourceRoot":"","sources":["../../../../src/components/operation-handlers/operation-pipeline.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE/C,OAAO,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAEvD,MAAM,WAAW,sBAAsB;IACrC,aAAa,EAAE,aAAa,CAAC;IAC7B,QAAQ,EAAE,wBAAwB,CAAC;IACnC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,EAAE,aAAa,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE,sBAAsB,eAgB9F"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { createComponent as _$createComponent } from "@alloy-js/core/jsx-runtime";
|
|
2
|
+
import * as ay from "@alloy-js/core";
|
|
3
|
+
import { ClientOperation as DefaultOperationComponent } from "../client-operation.js";
|
|
4
|
+
/**
|
|
5
|
+
* Component that manages the operation handler pipeline.
|
|
6
|
+
* It will try each handler in order until it finds one that can handle the operation.
|
|
7
|
+
* If no handler is found, it will use the default ClientOperation component.
|
|
8
|
+
*/
|
|
9
|
+
export function OperationPipeline({
|
|
10
|
+
httpOperation,
|
|
11
|
+
pipeline,
|
|
12
|
+
internal
|
|
13
|
+
}) {
|
|
14
|
+
for (const handler of pipeline.handlers) {
|
|
15
|
+
if (handler.canHandle(httpOperation)) {
|
|
16
|
+
return handler.handle(httpOperation);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// Default to standard client operation if no handler matched
|
|
21
|
+
const defaultOperationRefkey = ay.refkey(httpOperation.operation);
|
|
22
|
+
return _$createComponent(DefaultOperationComponent, {
|
|
23
|
+
httpOperation: httpOperation,
|
|
24
|
+
internal: internal,
|
|
25
|
+
refkey: defaultOperationRefkey
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=operation-pipeline.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operation-pipeline.js","names":["ay","ClientOperation","DefaultOperationComponent","OperationPipeline","httpOperation","pipeline","internal","handler","handlers","canHandle","handle","defaultOperationRefkey","refkey","operation","_$createComponent"],"sources":["../../../../src/components/operation-handlers/operation-pipeline.tsx"],"sourcesContent":[null],"mappings":";AAAA,OAAO,KAAKA,EAAE,MAAM,gBAAgB;AAEpC,SAASC,eAAe,IAAIC,yBAAyB;AASrD;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,iBAAiBA,CAAC;EAAEC,aAAa;EAAEC,QAAQ;EAAEC;AAAiC,CAAC,EAAE;EAC/F,KAAK,MAAMC,OAAO,IAAIF,QAAQ,CAACG,QAAQ,EAAE;IACvC,IAAID,OAAO,CAACE,SAAS,CAACL,aAAa,CAAC,EAAE;MACpC,OAAOG,OAAO,CAACG,MAAM,CAACN,aAAa,CAAC;IACtC;EACF;;EAEA;EACA,MAAMO,sBAAsB,GAAGX,EAAE,CAACY,MAAM,CAACR,aAAa,CAACS,SAAS,CAAC;EACjE,OAAAC,iBAAA,CACGZ,yBAAyB;IACxBE,aAAa,EAAEA,aAAa;IAC5BE,QAAQ,EAAEA,QAAQ;IAClBM,MAAM,EAAED;EAAsB;AAGpC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"page-item.d.ts","sourceRoot":"","sources":["../../../../../src/components/operation-handlers/paging/page-item.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAIrD,wBAAgB,mBAAmB,CAAC,eAAe,EAAE,eAAe,qCAQnE"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { createComponent as _$createComponent } from "@alloy-js/core/jsx-runtime";
|
|
2
|
+
import { $ } from "@typespec/compiler/experimental/typekit";
|
|
3
|
+
import { TypeExpression } from "@typespec/emitter-framework/typescript";
|
|
4
|
+
export function getPageItemTypeName(pagingOperation) {
|
|
5
|
+
const type = pagingOperation.output.pageItems.property.type;
|
|
6
|
+
// only accept array type
|
|
7
|
+
if (type.kind === "Model" && $.array.is(type)) {
|
|
8
|
+
return _$createComponent(TypeExpression, {
|
|
9
|
+
get type() {
|
|
10
|
+
return $.array.getElementType(type);
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
// not supported and throw exceptions
|
|
15
|
+
throw new Error("Not supported");
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=page-item.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"page-item.js","names":["$","TypeExpression","getPageItemTypeName","pagingOperation","type","output","pageItems","property","kind","array","is","_$createComponent","getElementType","Error"],"sources":["../../../../../src/components/operation-handlers/paging/page-item.tsx"],"sourcesContent":[null],"mappings":";AACA,SAASA,CAAC,QAAQ,yCAAyC;AAC3D,SAASC,cAAc,QAAQ,wCAAwC;AAEvE,OAAO,SAASC,mBAAmBA,CAACC,eAAgC,EAAE;EACpE,MAAMC,IAAI,GAAGD,eAAe,CAACE,MAAM,CAACC,SAAS,CAACC,QAAQ,CAACH,IAAI;EAC3D;EACA,IAAIA,IAAI,CAACI,IAAI,KAAK,OAAO,IAAIR,CAAC,CAACS,KAAK,CAACC,EAAE,CAACN,IAAI,CAAC,EAAE;IAC7C,OAAAO,iBAAA,CAAQV,cAAc;MAAA,IAACG,IAAIA,CAAA;QAAA,OAAEJ,CAAC,CAACS,KAAK,CAACG,cAAc,CAACR,IAAI,CAAC;MAAA;IAAA;EAC3D;EACA;EACA,MAAM,IAAIS,KAAK,CAAC,eAAe,CAAC;AAClC","ignoreList":[]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as ay from "@alloy-js/core";
|
|
2
|
+
import { PagingOperation } from "@typespec/compiler";
|
|
3
|
+
import { HttpOperation } from "@typespec/http";
|
|
4
|
+
export interface PageResponseProps {
|
|
5
|
+
operation: HttpOperation;
|
|
6
|
+
pagingOperation: PagingOperation;
|
|
7
|
+
}
|
|
8
|
+
export declare function getPageResponseTypeRefkey(operation: HttpOperation): ay.Refkey;
|
|
9
|
+
export declare function PageResponseDeclaration(props: PageResponseProps): ay.Children;
|
|
10
|
+
//# sourceMappingURL=page-response.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"page-response.d.ts","sourceRoot":"","sources":["../../../../../src/components/operation-handlers/paging/page-response.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAErC,OAAO,EAAE,eAAe,EAAkB,MAAM,oBAAoB,CAAC;AAErE,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,MAAM,WAAW,iBAAiB;IAChC,SAAS,EAAE,aAAa,CAAC;IACzB,eAAe,EAAE,eAAe,CAAC;CAClC;AAED,wBAAgB,yBAAyB,CAAC,SAAS,EAAE,aAAa,aAEjE;AACD,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,iBAAiB,eAyC/D"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { createComponent as _$createComponent } from "@alloy-js/core/jsx-runtime";
|
|
2
|
+
import * as ay from "@alloy-js/core";
|
|
3
|
+
import * as ts from "@alloy-js/typescript";
|
|
4
|
+
import * as ef from "@typespec/emitter-framework/typescript";
|
|
5
|
+
export function getPageResponseTypeRefkey(operation) {
|
|
6
|
+
return ay.refkey(operation, "page-response");
|
|
7
|
+
}
|
|
8
|
+
export function PageResponseDeclaration(props) {
|
|
9
|
+
const namePolicy = ts.useTSNamePolicy();
|
|
10
|
+
const interfaceName = namePolicy.getName(props.operation.operation.name + "PageResponse", "interface");
|
|
11
|
+
const definedResponses = props.pagingOperation.output;
|
|
12
|
+
// Only accept these respose items
|
|
13
|
+
const acceptedColumns = ["continuationToken", "pageItems", "nextLink", "prevLink", "firstLink", "lastLink"];
|
|
14
|
+
const responseProperties = [];
|
|
15
|
+
for (const key in definedResponses) {
|
|
16
|
+
const property = definedResponses[key];
|
|
17
|
+
if (acceptedColumns.includes(key) && !!property) {
|
|
18
|
+
responseProperties.push(property);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return _$createComponent(ts.InterfaceDeclaration, {
|
|
22
|
+
"export": true,
|
|
23
|
+
name: interfaceName,
|
|
24
|
+
get refkey() {
|
|
25
|
+
return getPageResponseTypeRefkey(props.operation);
|
|
26
|
+
},
|
|
27
|
+
get children() {
|
|
28
|
+
return _$createComponent(ay.For, {
|
|
29
|
+
each: responseProperties,
|
|
30
|
+
line: true,
|
|
31
|
+
children: parameter => _$createComponent(ts.InterfaceMember, {
|
|
32
|
+
get name() {
|
|
33
|
+
return parameter.property.name;
|
|
34
|
+
},
|
|
35
|
+
get optional() {
|
|
36
|
+
return parameter.property.optional;
|
|
37
|
+
},
|
|
38
|
+
get type() {
|
|
39
|
+
return _$createComponent(ef.TypeExpression, {
|
|
40
|
+
get type() {
|
|
41
|
+
return parameter.property.type;
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
})
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=page-response.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"page-response.js","names":["ay","ts","ef","getPageResponseTypeRefkey","operation","refkey","PageResponseDeclaration","props","namePolicy","useTSNamePolicy","interfaceName","getName","name","definedResponses","pagingOperation","output","acceptedColumns","responseProperties","key","property","includes","push","_$createComponent","InterfaceDeclaration","children","For","each","line","parameter","InterfaceMember","optional","type","TypeExpression"],"sources":["../../../../../src/components/operation-handlers/paging/page-response.tsx"],"sourcesContent":[null],"mappings":";AAAA,OAAO,KAAKA,EAAE,MAAM,gBAAgB;AACpC,OAAO,KAAKC,EAAE,MAAM,sBAAsB;AAE1C,OAAO,KAAKC,EAAE,MAAM,wCAAwC;AAO5D,OAAO,SAASC,yBAAyBA,CAACC,SAAwB,EAAE;EAClE,OAAOJ,EAAE,CAACK,MAAM,CAACD,SAAS,EAAE,eAAe,CAAC;AAC9C;AACA,OAAO,SAASE,uBAAuBA,CAACC,KAAwB,EAAE;EAChE,MAAMC,UAAU,GAAGP,EAAE,CAACQ,eAAe,CAAC,CAAC;EACvC,MAAMC,aAAa,GAAGF,UAAU,CAACG,OAAO,CACtCJ,KAAK,CAACH,SAAS,CAACA,SAAS,CAACQ,IAAI,GAAG,cAAc,EAC/C,WACF,CAAC;EACD,MAAMC,gBAAgB,GAAGN,KAAK,CAACO,eAAe,CAACC,MAAM;EACrD;EACA,MAAMC,eAAe,GAAG,CACtB,mBAAmB,EACnB,WAAW,EACX,UAAU,EACV,UAAU,EACV,WAAW,EACX,UAAU,CACX;EACD,MAAMC,kBAAoC,GAAG,EAAE;EAC/C,KAAK,MAAMC,GAAG,IAAIL,gBAAgB,EAAE;IAClC,MAAMM,QAAQ,GAAGN,gBAAgB,CAACK,GAAG,CAAkC;IACvE,IAAIF,eAAe,CAACI,QAAQ,CAACF,GAAG,CAAC,IAAI,CAAC,CAACC,QAAQ,EAAE;MAC/CF,kBAAkB,CAACI,IAAI,CAACF,QAAQ,CAAC;IACnC;EACF;EAEA,OAAAG,iBAAA,CACGrB,EAAE,CAACsB,oBAAoB;IAAA;IAEtBX,IAAI,EAAEF,aAAa;IAAA,IACnBL,MAAMA,CAAA;MAAA,OAAEF,yBAAyB,CAACI,KAAK,CAACH,SAAS,CAAC;IAAA;IAAA,IAAAoB,SAAA;MAAA,OAAAF,iBAAA,CAEjDtB,EAAE,CAACyB,GAAG;QAACC,IAAI,EAAET,kBAAkB;QAAEU,IAAI;QAAAH,QAAA,EAClCI,SAAS,IAAAN,iBAAA,CACRrB,EAAE,CAAC4B,eAAe;UAAA,IACjBjB,IAAIA,CAAA;YAAA,OAAEgB,SAAS,CAACT,QAAQ,CAACP,IAAI;UAAA;UAAA,IAC7BkB,QAAQA,CAAA;YAAA,OAAEF,SAAS,CAACT,QAAQ,CAACW,QAAQ;UAAA;UAAA,IACrCC,IAAIA,CAAA;YAAA,OAAAT,iBAAA,CAAGpB,EAAE,CAAC8B,cAAc;cAAA,IAACD,IAAIA,CAAA;gBAAA,OAAEH,SAAS,CAACT,QAAQ,CAACY,IAAI;cAAA;YAAA;UAAA;QAAA;MAEzD;IAAA;EAAA;AAIT","ignoreList":[]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as ay from "@alloy-js/core";
|
|
2
|
+
import { PagingOperation, PagingProperty } from "@typespec/compiler";
|
|
3
|
+
import { HttpOperation } from "@typespec/http";
|
|
4
|
+
export interface PageSettingsProps {
|
|
5
|
+
operation: HttpOperation;
|
|
6
|
+
pagingOperation: PagingOperation;
|
|
7
|
+
}
|
|
8
|
+
export declare function getPageSettingsTypeRefkey(operation: HttpOperation): ay.Refkey;
|
|
9
|
+
export declare function getPageSettingProperties(pagingOperation: PagingOperation): PagingProperty[];
|
|
10
|
+
export declare function PageSettingsDeclaration(props: PageSettingsProps): ay.Children;
|
|
11
|
+
//# sourceMappingURL=page-settings.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"page-settings.d.ts","sourceRoot":"","sources":["../../../../../src/components/operation-handlers/paging/page-settings.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAErC,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAErE,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,MAAM,WAAW,iBAAiB;IAChC,SAAS,EAAE,aAAa,CAAC;IACzB,eAAe,EAAE,eAAe,CAAC;CAClC;AAED,wBAAgB,yBAAyB,CAAC,SAAS,EAAE,aAAa,aAEjE;AAED,wBAAgB,wBAAwB,CAAC,eAAe,EAAE,eAAe,oBAYxE;AAED,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,iBAAiB,eAwB/D"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { createComponent as _$createComponent } from "@alloy-js/core/jsx-runtime";
|
|
2
|
+
import * as ay from "@alloy-js/core";
|
|
3
|
+
import * as ts from "@alloy-js/typescript";
|
|
4
|
+
import * as ef from "@typespec/emitter-framework/typescript";
|
|
5
|
+
export function getPageSettingsTypeRefkey(operation) {
|
|
6
|
+
return ay.refkey(operation, "page-settings");
|
|
7
|
+
}
|
|
8
|
+
export function getPageSettingProperties(pagingOperation) {
|
|
9
|
+
const definedSettings = pagingOperation.input;
|
|
10
|
+
// Only accept these page settings
|
|
11
|
+
const acceptedSettings = ["continuationToken", "offset", "pageSize", "pageIndex"];
|
|
12
|
+
const settingProperties = [];
|
|
13
|
+
for (const key in definedSettings) {
|
|
14
|
+
const property = definedSettings[key];
|
|
15
|
+
if (acceptedSettings.includes(key) && !!property) {
|
|
16
|
+
settingProperties.push(property);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return settingProperties;
|
|
20
|
+
}
|
|
21
|
+
export function PageSettingsDeclaration(props) {
|
|
22
|
+
const namePolicy = ts.useTSNamePolicy();
|
|
23
|
+
const interfaceName = namePolicy.getName(props.operation.operation.name + "PageSettings", "interface");
|
|
24
|
+
const settingProperties = getPageSettingProperties(props.pagingOperation);
|
|
25
|
+
return _$createComponent(ts.InterfaceDeclaration, {
|
|
26
|
+
"export": true,
|
|
27
|
+
name: interfaceName,
|
|
28
|
+
get refkey() {
|
|
29
|
+
return getPageSettingsTypeRefkey(props.operation);
|
|
30
|
+
},
|
|
31
|
+
get children() {
|
|
32
|
+
return _$createComponent(ay.For, {
|
|
33
|
+
each: settingProperties,
|
|
34
|
+
line: true,
|
|
35
|
+
children: parameter => _$createComponent(ts.InterfaceMember, {
|
|
36
|
+
get name() {
|
|
37
|
+
return parameter.property.name;
|
|
38
|
+
},
|
|
39
|
+
optional: true,
|
|
40
|
+
get type() {
|
|
41
|
+
return _$createComponent(ef.TypeExpression, {
|
|
42
|
+
get type() {
|
|
43
|
+
return parameter.property.type;
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
})
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=page-settings.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"page-settings.js","names":["ay","ts","ef","getPageSettingsTypeRefkey","operation","refkey","getPageSettingProperties","pagingOperation","definedSettings","input","acceptedSettings","settingProperties","key","property","includes","push","PageSettingsDeclaration","props","namePolicy","useTSNamePolicy","interfaceName","getName","name","_$createComponent","InterfaceDeclaration","children","For","each","line","parameter","InterfaceMember","optional","type","TypeExpression"],"sources":["../../../../../src/components/operation-handlers/paging/page-settings.tsx"],"sourcesContent":[null],"mappings":";AAAA,OAAO,KAAKA,EAAE,MAAM,gBAAgB;AACpC,OAAO,KAAKC,EAAE,MAAM,sBAAsB;AAE1C,OAAO,KAAKC,EAAE,MAAM,wCAAwC;AAO5D,OAAO,SAASC,yBAAyBA,CAACC,SAAwB,EAAE;EAClE,OAAOJ,EAAE,CAACK,MAAM,CAACD,SAAS,EAAE,eAAe,CAAC;AAC9C;AAEA,OAAO,SAASE,wBAAwBA,CAACC,eAAgC,EAAE;EACzE,MAAMC,eAAe,GAAGD,eAAe,CAACE,KAAK;EAC7C;EACA,MAAMC,gBAAgB,GAAG,CAAC,mBAAmB,EAAE,QAAQ,EAAE,UAAU,EAAE,WAAW,CAAC;EACjF,MAAMC,iBAAmC,GAAG,EAAE;EAC9C,KAAK,MAAMC,GAAG,IAAIJ,eA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"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,gBA2DvC,CAAC"}
|