@typespec/http-client-js 0.4.0-dev.7 → 0.4.0-dev.8
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-factory.d.ts.map +1 -1
- package/dist/src/components/client-context/client-context-factory.js +10 -1
- package/dist/src/components/client-operation.d.ts.map +1 -1
- package/dist/src/components/client-operation.js +4 -1
- package/dist/src/components/client.d.ts.map +1 -1
- package/dist/src/components/client.js +13 -1
- package/dist/src/components/http-response.d.ts.map +1 -1
- package/dist/src/components/http-response.js +4 -1
- package/dist/src/components/models.d.ts.map +1 -1
- package/dist/src/components/models.js +4 -1
- package/dist/src/components/operation-handlers/paging/page-item.d.ts.map +1 -1
- package/dist/src/components/operation-handlers/paging/page-item.js +4 -1
- 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 +7 -1
- package/dist/src/components/output.d.ts +2 -0
- package/dist/src/components/output.d.ts.map +1 -1
- package/dist/src/components/output.js +6 -5
- package/dist/src/components/serializers.d.ts.map +1 -1
- package/dist/src/components/serializers.js +7 -4
- package/dist/src/components/transforms/data-transform.d.ts.map +1 -1
- package/dist/src/components/transforms/data-transform.js +4 -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 +7 -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 -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 +4 -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 +7 -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 +7 -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 +7 -1
- package/dist/src/components/transforms/json/json-transform.d.ts.map +1 -1
- package/dist/src/components/transforms/json/json-transform.js +10 -1
- package/dist/src/components/transforms/json/union-transform.d.ts.map +1 -1
- package/dist/src/components/transforms/json/union-transform.js +4 -1
- package/dist/src/components/transforms/json/utils/transport-namer.d.ts +2 -1
- package/dist/src/components/transforms/json/utils/transport-namer.d.ts.map +1 -1
- package/dist/src/components/transforms/json/utils/transport-namer.js +1 -2
- package/dist/src/components/transforms/multipart/multipart-transform.d.ts.map +1 -1
- package/dist/src/components/transforms/multipart/multipart-transform.js +4 -2
- package/dist/src/components/transforms/multipart/simple-part-transform.d.ts.map +1 -1
- package/dist/src/components/transforms/multipart/simple-part-transform.js +4 -1
- package/dist/src/components/transforms/operation-transform-expression.d.ts.map +1 -1
- package/dist/src/components/transforms/operation-transform-expression.js +4 -2
- package/dist/src/components/transforms/scalar-transform.js +95 -78
- package/dist/src/components/transforms/transform-name-policy.d.ts.map +1 -1
- package/dist/src/components/transforms/transform-name-policy.js +6 -1
- package/dist/src/components/utils/unpack-model-property.d.ts.map +1 -1
- package/dist/src/components/utils/unpack-model-property.js +4 -1
- package/dist/src/context/encoding/encoding-context.d.ts.map +1 -1
- package/dist/src/context/encoding/encoding-context.js +4 -1
- package/dist/src/emitter.js +4 -1
- package/dist/src/utils/multipart.d.ts.map +1 -1
- package/dist/src/utils/multipart.js +4 -1
- package/dist/src/utils/operations.d.ts +3 -2
- package/dist/src/utils/operations.d.ts.map +1 -1
- package/dist/src/utils/operations.js +12 -13
- package/dist/src/utils/parameters.d.ts.map +1 -1
- package/dist/src/utils/parameters.js +7 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/components/client-context/client-context-factory.tsx +4 -1
- package/src/components/client-operation.tsx +2 -1
- package/src/components/client.tsx +5 -1
- package/src/components/http-response.tsx +2 -1
- package/src/components/models.tsx +2 -1
- package/src/components/operation-handlers/paging/page-item.tsx +2 -1
- package/src/components/operation-handlers/paging/paginated-operation-handler.tsx +3 -1
- package/src/components/output.tsx +10 -5
- package/src/components/serializers.tsx +6 -4
- package/src/components/transforms/data-transform.tsx +2 -1
- package/src/components/transforms/json/json-array-transform.tsx +3 -1
- package/src/components/transforms/json/json-model-additional-properties-transform.tsx +2 -1
- package/src/components/transforms/json/json-model-property-transform.tsx +2 -1
- package/src/components/transforms/json/json-model-transform.tsx +3 -1
- package/src/components/transforms/json/json-record-transform.tsx +3 -1
- package/src/components/transforms/json/json-transform-discriminator.tsx +3 -1
- package/src/components/transforms/json/json-transform.tsx +4 -1
- package/src/components/transforms/json/union-transform.tsx +2 -1
- package/src/components/transforms/json/utils/transport-namer.ts +2 -2
- package/src/components/transforms/multipart/multipart-transform.tsx +2 -2
- package/src/components/transforms/multipart/simple-part-transform.tsx +2 -1
- package/src/components/transforms/operation-transform-expression.tsx +2 -2
- package/src/components/transforms/scalar-transform.tsx +42 -32
- package/src/components/transforms/transform-name-policy.ts +2 -1
- package/src/components/utils/unpack-model-property.ts +2 -1
- package/src/context/encoding/encoding-context.tsx +2 -1
- package/src/emitter.tsx +2 -2
- package/src/utils/multipart.ts +2 -1
- package/src/utils/operations.ts +13 -11
- package/src/utils/parameters.tsx +3 -1
|
@@ -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,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAKrC,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,aAE3D;AAED,wBAAgB,+BAA+B,CAAC,KAAK,EAAE,yBAAyB,
|
|
1
|
+
{"version":3,"file":"client-context-factory.d.ts","sourceRoot":"","sources":["../../../../src/components/client-context/client-context-factory.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAKrC,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,aAE3D;AAED,wBAAgB,+BAA+B,CAAC,KAAK,EAAE,yBAAyB,eA+C/E"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createComponent as _$createComponent, memo as _$memo } from "@alloy-js/core/jsx-runtime";
|
|
2
2
|
import * as ay from "@alloy-js/core";
|
|
3
3
|
import * as ts from "@alloy-js/typescript";
|
|
4
|
-
import {
|
|
4
|
+
import { useTsp } from "@typespec/emitter-framework";
|
|
5
5
|
import { FunctionDeclaration } from "@typespec/emitter-framework/typescript";
|
|
6
6
|
import { reportDiagnostic } from "../../lib.js";
|
|
7
7
|
import { buildClientParameters } from "../../utils/parameters.js";
|
|
@@ -13,6 +13,9 @@ export function getClientContextFactoryRef(client) {
|
|
|
13
13
|
return ay.refkey(client, "contextFactory");
|
|
14
14
|
}
|
|
15
15
|
export function ClientContextFactoryDeclaration(props) {
|
|
16
|
+
const {
|
|
17
|
+
$
|
|
18
|
+
} = useTsp();
|
|
16
19
|
const ref = getClientContextFactoryRef(props.client);
|
|
17
20
|
const contextDeclarationRef = getClientcontextDeclarationRef(props.client);
|
|
18
21
|
const namePolicy = ts.useTSNamePolicy();
|
|
@@ -74,6 +77,9 @@ function ClientFactoryArguments(props) {
|
|
|
74
77
|
}) : _$createComponent(ClientOptionsExpression, {})];
|
|
75
78
|
}
|
|
76
79
|
function AuthScheme(props) {
|
|
80
|
+
const {
|
|
81
|
+
$
|
|
82
|
+
} = useTsp();
|
|
77
83
|
switch (props.scheme.type) {
|
|
78
84
|
case "http":
|
|
79
85
|
return _$createComponent(ts.ObjectExpression, {
|
|
@@ -173,6 +179,9 @@ function OAuth2Flow(props) {
|
|
|
173
179
|
});
|
|
174
180
|
}
|
|
175
181
|
function AuthSchemeOptions(props) {
|
|
182
|
+
const {
|
|
183
|
+
$
|
|
184
|
+
} = useTsp();
|
|
176
185
|
const clientCredential = $.client.getAuth(props.client);
|
|
177
186
|
if (clientCredential.schemes.length === 0) {
|
|
178
187
|
return null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client-operation.d.ts","sourceRoot":"","sources":["../../../src/components/client-operation.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAIrC,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAU5C,MAAM,WAAW,qBAAqB;IACpC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC;CACnB;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,eAqB5D;AAED,MAAM,WAAW,oBAAoB;IACnC,aAAa,EAAE,aAAa,CAAC;IAC7B,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,oBAAoB,
|
|
1
|
+
{"version":3,"file":"client-operation.d.ts","sourceRoot":"","sources":["../../../src/components/client-operation.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAIrC,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAU5C,MAAM,WAAW,qBAAqB;IACpC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC;CACnB;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,eAqB5D;AAED,MAAM,WAAW,oBAAoB;IACnC,aAAa,EAAE,aAAa,CAAC;IAC7B,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,oBAAoB,eAwC1D"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createComponent as _$createComponent } from "@alloy-js/core/jsx-runtime";
|
|
2
2
|
import * as ay from "@alloy-js/core";
|
|
3
3
|
import * as ts from "@alloy-js/typescript";
|
|
4
|
-
import {
|
|
4
|
+
import { useTsp } from "@typespec/emitter-framework";
|
|
5
5
|
import { FunctionDeclaration, TypeExpression } from "@typespec/emitter-framework/typescript";
|
|
6
6
|
import * as cl from "@typespec/http-client";
|
|
7
7
|
import { reportDiagnostic } from "../lib.js";
|
|
@@ -37,6 +37,9 @@ export function ClientOperations(props) {
|
|
|
37
37
|
});
|
|
38
38
|
}
|
|
39
39
|
export function ClientOperation(props) {
|
|
40
|
+
const {
|
|
41
|
+
$
|
|
42
|
+
} = useTsp();
|
|
40
43
|
const clientLibrary = cl.useClientLibrary();
|
|
41
44
|
const client = clientLibrary.getClientForOperation(props.httpOperation);
|
|
42
45
|
if (!client) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/components/client.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAIrC,OAAO,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAQ5C,MAAM,WAAW,WAAW;CAAG;AAE/B,wBAAgB,MAAM,CAAC,KAAK,EAAE,WAAW,
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/components/client.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAIrC,OAAO,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAQ5C,MAAM,WAAW,WAAW;CAAG;AAE/B,wBAAgB,MAAM,CAAC,KAAK,EAAE,WAAW,eAoBxC;AAED,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC;CACnB;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,aAElD;AAKD,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,eAiDlD;AAkED,MAAM,WAAW,wBAAwB;IACvC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC;IAClB,IAAI,EAAE,EAAE,CAAC,MAAM,EAAE,CAAC;CACnB"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createComponent as _$createComponent, createIntrinsic as _$createIntrinsic } from "@alloy-js/core/jsx-runtime";
|
|
2
2
|
import * as ay from "@alloy-js/core";
|
|
3
3
|
import * as ts from "@alloy-js/typescript";
|
|
4
|
-
import {
|
|
4
|
+
import { useTsp } from "@typespec/emitter-framework";
|
|
5
5
|
import { ClassMethod } from "@typespec/emitter-framework/typescript";
|
|
6
6
|
import { useClientLibrary } from "@typespec/http-client";
|
|
7
7
|
import { flattenClients } from "../utils/client-discovery.js";
|
|
@@ -10,6 +10,9 @@ import { getClientcontextDeclarationRef } from "./client-context/client-context-
|
|
|
10
10
|
import { getClientContextFactoryRef } from "./client-context/client-context-factory.js";
|
|
11
11
|
import { getOperationParameters } from "./operation-parameters.js";
|
|
12
12
|
export function Client(props) {
|
|
13
|
+
const {
|
|
14
|
+
$
|
|
15
|
+
} = useTsp();
|
|
13
16
|
const namePolicy = ts.useTSNamePolicy();
|
|
14
17
|
const {
|
|
15
18
|
topLevel
|
|
@@ -42,6 +45,9 @@ function getClientContextFieldRef(client) {
|
|
|
42
45
|
return ay.refkey(client.type, "client-context");
|
|
43
46
|
}
|
|
44
47
|
export function ClientClass(props) {
|
|
48
|
+
const {
|
|
49
|
+
$
|
|
50
|
+
} = useTsp();
|
|
45
51
|
const namePolicy = ts.useTSNamePolicy();
|
|
46
52
|
const clientName = namePolicy.getName($.client.getName(props.client), "class");
|
|
47
53
|
const contextMemberRef = getClientContextFieldRef(props.client);
|
|
@@ -111,6 +117,9 @@ function getSubClientClassFieldRef(client) {
|
|
|
111
117
|
return ay.refkey(client.type, "client-field");
|
|
112
118
|
}
|
|
113
119
|
function SubClientClassField(props) {
|
|
120
|
+
const {
|
|
121
|
+
$
|
|
122
|
+
} = useTsp();
|
|
114
123
|
const parent = props.client.parent;
|
|
115
124
|
// If sub client has different parameters than client, don't add it as a subclass field
|
|
116
125
|
// Todo: We need to detect the extra parameters and make this field a factory for the subclient
|
|
@@ -128,6 +137,9 @@ function SubClientClassField(props) {
|
|
|
128
137
|
});
|
|
129
138
|
}
|
|
130
139
|
function ClientConstructor(props) {
|
|
140
|
+
const {
|
|
141
|
+
$
|
|
142
|
+
} = useTsp();
|
|
131
143
|
const subClients = props.client.subClients.filter(sc => $.client.haveSameConstructor(sc, props.client));
|
|
132
144
|
const clientContextFieldRef = getClientContextFieldRef(props.client);
|
|
133
145
|
const clientContextFactoryRef = getClientContextFactoryRef(props.client);
|
|
@@ -1 +1 @@
|
|
|
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,
|
|
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,YA6CtD"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createComponent as _$createComponent, memo as _$memo } from "@alloy-js/core/jsx-runtime";
|
|
2
2
|
import { code, For, List } from "@alloy-js/core";
|
|
3
3
|
import { isVoidType } from "@typespec/compiler";
|
|
4
|
-
import {
|
|
4
|
+
import { useTsp } from "@typespec/emitter-framework";
|
|
5
5
|
import { getCreateRestErrorRefkey } from "./static-helpers/rest-error.js";
|
|
6
6
|
import { ContentTypeEncodingProvider } from "./transforms/content-type-encoding-provider.js";
|
|
7
7
|
import { JsonTransform } from "./transforms/json/json-transform.js";
|
|
@@ -18,6 +18,9 @@ export function HttpResponse(props) {
|
|
|
18
18
|
});
|
|
19
19
|
}
|
|
20
20
|
export function HttpResponses(props) {
|
|
21
|
+
const {
|
|
22
|
+
$
|
|
23
|
+
} = useTsp();
|
|
21
24
|
// Handle response by status code and content type
|
|
22
25
|
const responses = $.httpOperation.flattenResponses(props.httpOperation);
|
|
23
26
|
return _$createComponent(For, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../../../src/components/models.tsx"],"names":[],"mappings":"AAOA,MAAM,WAAW,WAAW;IAC1B,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,wBAAgB,MAAM,CAAC,KAAK,EAAE,WAAW,
|
|
1
|
+
{"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../../../src/components/models.tsx"],"names":[],"mappings":"AAOA,MAAM,WAAW,WAAW;IAC1B,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,wBAAgB,MAAM,CAAC,KAAK,EAAE,WAAW,qCAsBxC"}
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { memo as _$memo, createComponent as _$createComponent } from "@alloy-js/core/jsx-runtime";
|
|
2
2
|
import { For, refkey } from "@alloy-js/core";
|
|
3
3
|
import * as ts from "@alloy-js/typescript";
|
|
4
|
-
import {
|
|
4
|
+
import { useTsp } from "@typespec/emitter-framework";
|
|
5
5
|
import * as ef from "@typespec/emitter-framework/typescript";
|
|
6
6
|
import { useClientLibrary } from "@typespec/http-client";
|
|
7
7
|
import { getFileTypeReference } from "./static-helpers/multipart-helpers.js";
|
|
8
8
|
export function Models(props) {
|
|
9
|
+
const {
|
|
10
|
+
$
|
|
11
|
+
} = useTsp();
|
|
9
12
|
const clientLibrary = useClientLibrary();
|
|
10
13
|
const dataTypes = clientLibrary.dataTypes;
|
|
11
14
|
return _$createComponent(ts.SourceFile, {
|
|
@@ -1 +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,
|
|
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,qCASnE"}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { createComponent as _$createComponent } from "@alloy-js/core/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { useTsp } from "@typespec/emitter-framework";
|
|
3
3
|
import { TypeExpression } from "@typespec/emitter-framework/typescript";
|
|
4
4
|
export function getPageItemTypeName(pagingOperation) {
|
|
5
|
+
const {
|
|
6
|
+
$
|
|
7
|
+
} = useTsp();
|
|
5
8
|
const type = pagingOperation.output.pageItems.property.type;
|
|
6
9
|
// only accept array type
|
|
7
10
|
if (type.kind === "Model" && $.array.is(type)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paginated-operation-handler.d.ts","sourceRoot":"","sources":["../../../../../src/components/operation-handlers/paging/paginated-operation-handler.tsx"],"names":[],"mappings":"AA4BA,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,eAAO,MAAM,yBAAyB,EAAE,
|
|
1
|
+
{"version":3,"file":"paginated-operation-handler.d.ts","sourceRoot":"","sources":["../../../../../src/components/operation-handlers/paging/paginated-operation-handler.tsx"],"names":[],"mappings":"AA4BA,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,eAAO,MAAM,yBAAyB,EAAE,gBA6DvC,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createComponent as _$createComponent, memo as _$memo } from "@alloy-js/core/jsx-runtime";
|
|
2
2
|
import * as ay from "@alloy-js/core";
|
|
3
3
|
import * as ts from "@alloy-js/typescript";
|
|
4
|
-
import {
|
|
4
|
+
import { useTsp } from "@typespec/emitter-framework";
|
|
5
5
|
import { FunctionDeclaration } from "@typespec/emitter-framework/typescript";
|
|
6
6
|
import * as cl from "@typespec/http-client";
|
|
7
7
|
import { reportDiagnostic } from "../../../lib.js";
|
|
@@ -17,10 +17,16 @@ import { getHttpRequestDeserializeRefkey, HttpResponseDeserialize } from "../pag
|
|
|
17
17
|
import { extractPagingDetail } from "../paging/util.js";
|
|
18
18
|
export const PaginatedOperationHandler = {
|
|
19
19
|
canHandle(httpOperation) {
|
|
20
|
+
const {
|
|
21
|
+
$
|
|
22
|
+
} = useTsp();
|
|
20
23
|
const pagingMetadata = $.operation.getPagingMetadata(httpOperation.operation);
|
|
21
24
|
return pagingMetadata !== undefined;
|
|
22
25
|
},
|
|
23
26
|
handle(httpOperation) {
|
|
27
|
+
const {
|
|
28
|
+
$
|
|
29
|
+
} = useTsp();
|
|
24
30
|
const clientLibrary = cl.useClientLibrary();
|
|
25
31
|
const client = clientLibrary.getClientForOperation(httpOperation);
|
|
26
32
|
if (!client) {
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import * as ay from "@alloy-js/core";
|
|
2
|
+
import { Program } from "@typespec/compiler";
|
|
2
3
|
export interface OutputProps {
|
|
3
4
|
children?: ay.Children;
|
|
5
|
+
program: Program;
|
|
4
6
|
}
|
|
5
7
|
export declare function Output(props: OutputProps): ay.Children;
|
|
6
8
|
//# sourceMappingURL=output.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../../../src/components/output.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../../../src/components/output.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAErC,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAQ7C,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC;IACvB,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,wBAAgB,MAAM,CAAC,KAAK,EAAE,WAAW,eAgBxC"}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { createComponent as _$createComponent } from "@alloy-js/core/jsx-runtime";
|
|
2
|
-
import * as ay from "@alloy-js/core";
|
|
3
2
|
import * as ts from "@alloy-js/typescript";
|
|
4
|
-
import {
|
|
5
|
-
import { TransformNamePolicyContext } from "@typespec/emitter-framework";
|
|
3
|
+
import { Output as EFOutput, TransformNamePolicyContext } from "@typespec/emitter-framework";
|
|
6
4
|
import { ClientLibrary } from "@typespec/http-client/components";
|
|
7
5
|
import { EncodingProvider } from "./encoding-provider.js";
|
|
8
6
|
import { httpRuntimeTemplateLib } from "./external-packages/ts-http-runtime.js";
|
|
@@ -11,13 +9,16 @@ import { createTransformNamePolicy } from "./transforms/transform-name-policy.js
|
|
|
11
9
|
export function Output(props) {
|
|
12
10
|
const tsNamePolicy = ts.createTSNamePolicy();
|
|
13
11
|
const defaultTransformNamePolicy = createTransformNamePolicy();
|
|
14
|
-
return _$createComponent(
|
|
12
|
+
return _$createComponent(EFOutput, {
|
|
15
13
|
namePolicy: tsNamePolicy,
|
|
16
14
|
externals: [uriTemplateLib, httpRuntimeTemplateLib],
|
|
15
|
+
get program() {
|
|
16
|
+
return props.program;
|
|
17
|
+
},
|
|
17
18
|
get children() {
|
|
18
19
|
return _$createComponent(ClientLibrary, {
|
|
19
20
|
get program() {
|
|
20
|
-
return
|
|
21
|
+
return props.program;
|
|
21
22
|
},
|
|
22
23
|
get children() {
|
|
23
24
|
return _$createComponent(TransformNamePolicyContext.Provider, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serializers.d.ts","sourceRoot":"","sources":["../../../src/components/serializers.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"serializers.d.ts","sourceRoot":"","sources":["../../../src/components/serializers.tsx"],"names":[],"mappings":"AAkBA,MAAM,WAAW,qBAAqB;IACpC,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,qCAuC5D"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { memo as _$memo, createComponent as _$createComponent } from "@alloy-js/core/jsx-runtime";
|
|
2
2
|
import * as ts from "@alloy-js/typescript";
|
|
3
|
-
import {
|
|
3
|
+
import { useTsp } from "@typespec/emitter-framework";
|
|
4
4
|
import { DateDeserializer, DateRfc3339Serializer, DateRfc7231Deserializer, DateRfc7231Serializer, DateUnixTimestampDeserializer, DateUnixTimestampSerializer } from "@typespec/emitter-framework/typescript";
|
|
5
5
|
import { useClientLibrary } from "@typespec/http-client";
|
|
6
6
|
import { flattenClients } from "../utils/client-discovery.js";
|
|
@@ -9,6 +9,9 @@ import { DecodeBase64, EncodeUint8Array } from "./static-helpers/bytes-encoding.
|
|
|
9
9
|
import { JsonTransformDeclaration } from "./transforms/json/json-transform.js";
|
|
10
10
|
import { TransformDeclaration } from "./transforms/operation-transform-declaration.js";
|
|
11
11
|
export function ModelSerializers(props) {
|
|
12
|
+
const {
|
|
13
|
+
$
|
|
14
|
+
} = useTsp();
|
|
12
15
|
const clientLibrary = useClientLibrary();
|
|
13
16
|
const dataTypes = clientLibrary.dataTypes;
|
|
14
17
|
const flatClients = clientLibrary.topLevel.flatMap(c => flattenClients(c));
|
|
@@ -25,7 +28,7 @@ export function ModelSerializers(props) {
|
|
|
25
28
|
operation: o
|
|
26
29
|
}))), _$memo(() => dataTypes.filter(m => m.kind === "Model" || m.kind === "Union").map(type => {
|
|
27
30
|
let bytesDefaultEncoding = "base64";
|
|
28
|
-
if (isOrExtendsFile(type)) {
|
|
31
|
+
if (isOrExtendsFile($, type)) {
|
|
29
32
|
bytesDefaultEncoding = "none";
|
|
30
33
|
}
|
|
31
34
|
return _$createComponent(EncodingProvider, {
|
|
@@ -46,12 +49,12 @@ export function ModelSerializers(props) {
|
|
|
46
49
|
}
|
|
47
50
|
});
|
|
48
51
|
}
|
|
49
|
-
function isOrExtendsFile(type) {
|
|
52
|
+
function isOrExtendsFile($, type) {
|
|
50
53
|
if (!$.model.is(type)) {
|
|
51
54
|
return false;
|
|
52
55
|
}
|
|
53
56
|
if ($.model.isHttpFile(type)) {
|
|
54
57
|
return true;
|
|
55
58
|
}
|
|
56
|
-
return type.baseModel ? isOrExtendsFile(type.baseModel) : false;
|
|
59
|
+
return type.baseModel ? isOrExtendsFile($, type.baseModel) : false;
|
|
57
60
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-transform.d.ts","sourceRoot":"","sources":["../../../../src/components/transforms/data-transform.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAc,aAAa,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAMvE,MAAM,WAAW,wBAAwB;IACvC,OAAO,EAAE,MAAM,GAAG,QAAQ,CAAC;IAC3B,IAAI,EAAE,MAAM,GAAG,aAAa,CAAC;IAC7B,MAAM,EAAE,WAAW,GAAG,aAAa,CAAC;CACrC;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,wBAAwB,
|
|
1
|
+
{"version":3,"file":"data-transform.d.ts","sourceRoot":"","sources":["../../../../src/components/transforms/data-transform.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAc,aAAa,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAMvE,MAAM,WAAW,wBAAwB;IACvC,OAAO,EAAE,MAAM,GAAG,QAAQ,CAAC;IAC3B,IAAI,EAAE,MAAM,GAAG,aAAa,CAAC;IAC7B,MAAM,EAAE,WAAW,GAAG,aAAa,CAAC;CACrC;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,wBAAwB,YA0BlE"}
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useTsp } from "@typespec/emitter-framework";
|
|
2
2
|
import { reportDiagnostic } from "../../lib.js";
|
|
3
3
|
import { unpackProperty } from "../utils/unpack-model-property.js";
|
|
4
4
|
import { getScalarTransformer } from "./scalar-transform.js";
|
|
5
5
|
export function ScalarDataTransform(props) {
|
|
6
|
+
const {
|
|
7
|
+
$
|
|
8
|
+
} = useTsp();
|
|
6
9
|
let scalar;
|
|
7
10
|
let encoding;
|
|
8
11
|
if ($.modelProperty.is(props.type)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json-array-transform.d.ts","sourceRoot":"","sources":["../../../../../src/components/transforms/json/json-array-transform.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAIrC,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAI3C,MAAM,WAAW,uBAAuB;IACtC,OAAO,EAAE,EAAE,CAAC,MAAM,GAAG,EAAE,CAAC,QAAQ,CAAC;IACjC,IAAI,EAAE,KAAK,CAAC;IACZ,MAAM,EAAE,WAAW,GAAG,aAAa,CAAC;CACrC;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,uBAAuB,
|
|
1
|
+
{"version":3,"file":"json-array-transform.d.ts","sourceRoot":"","sources":["../../../../../src/components/transforms/json/json-array-transform.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAIrC,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAI3C,MAAM,WAAW,uBAAuB;IACtC,OAAO,EAAE,EAAE,CAAC,MAAM,GAAG,EAAE,CAAC,QAAQ,CAAC;IACjC,IAAI,EAAE,KAAK,CAAC;IACZ,MAAM,EAAE,WAAW,GAAG,aAAa,CAAC;CACrC;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,uBAAuB,eAqBhE;AAED,wBAAgB,2BAA2B,CACzC,IAAI,EAAE,KAAK,EACX,MAAM,EAAE,WAAW,GAAG,aAAa,GAClC,EAAE,CAAC,MAAM,CAEX;AAED,MAAM,WAAW,kCAAkC;IACjD,IAAI,EAAE,KAAK,CAAC;IACZ,MAAM,EAAE,WAAW,GAAG,aAAa,CAAC;CACrC;AAED,wBAAgB,6BAA6B,CAAC,KAAK,EAAE,kCAAkC,eAqCtF"}
|
|
@@ -2,9 +2,12 @@ import { createComponent as _$createComponent, mergeProps as _$mergeProps } from
|
|
|
2
2
|
import * as ay from "@alloy-js/core";
|
|
3
3
|
import * as ts from "@alloy-js/typescript";
|
|
4
4
|
import * as ef from "@typespec/emitter-framework/typescript";
|
|
5
|
-
import {
|
|
5
|
+
import { useTsp } from "@typespec/emitter-framework";
|
|
6
6
|
import { JsonTransform } from "./json-transform.js";
|
|
7
7
|
export function JsonArrayTransform(props) {
|
|
8
|
+
const {
|
|
9
|
+
$
|
|
10
|
+
} = useTsp();
|
|
8
11
|
if (!$.array.is(props.type)) {
|
|
9
12
|
return null;
|
|
10
13
|
}
|
|
@@ -33,6 +36,9 @@ export function getJsonArrayTransformRefkey(type, target) {
|
|
|
33
36
|
return ay.refkey(type, "json_array_transform", target);
|
|
34
37
|
}
|
|
35
38
|
export function JsonArrayTransformDeclaration(props) {
|
|
39
|
+
const {
|
|
40
|
+
$
|
|
41
|
+
} = useTsp();
|
|
36
42
|
if (!$.array.is(props.type)) {
|
|
37
43
|
return null;
|
|
38
44
|
}
|
package/dist/src/components/transforms/json/json-model-additional-properties-transform.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json-model-additional-properties-transform.d.ts","sourceRoot":"","sources":["../../../../../src/components/transforms/json/json-model-additional-properties-transform.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAErC,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAI3C,MAAM,WAAW,sCAAsC;IACrD,OAAO,EAAE,EAAE,CAAC,QAAQ,CAAC;IACrB,IAAI,EAAE,KAAK,CAAC;IACZ,MAAM,EAAE,WAAW,GAAG,aAAa,CAAC;CACrC;AAED,wBAAgB,iCAAiC,CAAC,KAAK,EAAE,sCAAsC,
|
|
1
|
+
{"version":3,"file":"json-model-additional-properties-transform.d.ts","sourceRoot":"","sources":["../../../../../src/components/transforms/json/json-model-additional-properties-transform.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAErC,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAI3C,MAAM,WAAW,sCAAsC;IACrD,OAAO,EAAE,EAAE,CAAC,QAAQ,CAAC;IACrB,IAAI,EAAE,KAAK,CAAC;IACZ,MAAM,EAAE,WAAW,GAAG,aAAa,CAAC;CACrC;AAED,wBAAgB,iCAAiC,CAAC,KAAK,EAAE,sCAAsC,eAwC9F"}
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { createComponent as _$createComponent, memo as _$memo } from "@alloy-js/core/jsx-runtime";
|
|
2
2
|
import * as ay from "@alloy-js/core";
|
|
3
3
|
import * as ts from "@alloy-js/typescript";
|
|
4
|
-
import {
|
|
4
|
+
import { useTsp } from "@typespec/emitter-framework";
|
|
5
5
|
import { getJsonRecordTransformRefkey } from "./json-record-transform.js";
|
|
6
6
|
export function JsonAdditionalPropertiesTransform(props) {
|
|
7
|
+
const {
|
|
8
|
+
$
|
|
9
|
+
} = useTsp();
|
|
7
10
|
const additionalProperties = $.model.getAdditionalPropertiesRecord(props.type);
|
|
8
11
|
if (!additionalProperties) {
|
|
9
12
|
return null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json-model-property-transform.d.ts","sourceRoot":"","sources":["../../../../../src/components/transforms/json/json-model-property-transform.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAErC,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAOnD,MAAM,WAAW,+BAA+B;IAC9C,OAAO,EAAE,EAAE,CAAC,MAAM,GAAG,EAAE,CAAC,QAAQ,CAAC;IACjC,IAAI,EAAE,aAAa,CAAC;IACpB,MAAM,EAAE,WAAW,GAAG,aAAa,CAAC;CACrC;AAED,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,+BAA+B,
|
|
1
|
+
{"version":3,"file":"json-model-property-transform.d.ts","sourceRoot":"","sources":["../../../../../src/components/transforms/json/json-model-property-transform.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAErC,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAOnD,MAAM,WAAW,+BAA+B;IAC9C,OAAO,EAAE,EAAE,CAAC,MAAM,GAAG,EAAE,CAAC,QAAQ,CAAC;IACjC,IAAI,EAAE,aAAa,CAAC;IACpB,MAAM,EAAE,WAAW,GAAG,aAAa,CAAC;CACrC;AAED,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,+BAA+B,eAoChF"}
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { createComponent as _$createComponent } from "@alloy-js/core/jsx-runtime";
|
|
2
2
|
import * as ay from "@alloy-js/core";
|
|
3
3
|
import * as ts from "@alloy-js/typescript";
|
|
4
|
-
import {
|
|
4
|
+
import { useTsp } from "@typespec/emitter-framework";
|
|
5
5
|
import { unpackProperty } from "../../utils/unpack-model-property.js";
|
|
6
6
|
import { ScalarDataTransform } from "../data-transform.js";
|
|
7
7
|
import { useTransformNamePolicy } from "../transform-name-policy.js";
|
|
8
8
|
import { JsonTransform } from "./json-transform.js";
|
|
9
9
|
export function JsonModelPropertyTransform(props) {
|
|
10
|
+
const {
|
|
11
|
+
$
|
|
12
|
+
} = useTsp();
|
|
10
13
|
const transformNamer = useTransformNamePolicy();
|
|
11
14
|
const propertyValueType = unpackProperty(props.type);
|
|
12
15
|
const transportName = transformNamer.getTransportName(props.type);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json-model-transform.d.ts","sourceRoot":"","sources":["../../../../../src/components/transforms/json/json-model-transform.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAGrC,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAU3C,MAAM,WAAW,uBAAuB;IACtC,OAAO,EAAE,EAAE,CAAC,MAAM,GAAG,EAAE,CAAC,QAAQ,CAAC;IACjC,IAAI,EAAE,KAAK,CAAC;IACZ,MAAM,EAAE,WAAW,GAAG,aAAa,CAAC;CACrC;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,uBAAuB,
|
|
1
|
+
{"version":3,"file":"json-model-transform.d.ts","sourceRoot":"","sources":["../../../../../src/components/transforms/json/json-model-transform.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAGrC,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAU3C,MAAM,WAAW,uBAAuB;IACtC,OAAO,EAAE,EAAE,CAAC,MAAM,GAAG,EAAE,CAAC,QAAQ,CAAC;IACjC,IAAI,EAAE,KAAK,CAAC;IACZ,MAAM,EAAE,WAAW,GAAG,aAAa,CAAC;CACrC;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,uBAAuB,eAoChE;AAED,wBAAgB,2BAA2B,CACzC,IAAI,EAAE,KAAK,EACX,MAAM,EAAE,WAAW,GAAG,aAAa,GAClC,EAAE,CAAC,MAAM,CAEX;AAED,MAAM,WAAW,kCAAkC;IACjD,IAAI,EAAE,KAAK,CAAC;IACZ,MAAM,EAAE,WAAW,GAAG,aAAa,CAAC;CACrC;AAED,wBAAgB,6BAA6B,CAC3C,KAAK,EAAE,kCAAkC,GACxC,EAAE,CAAC,QAAQ,CA6Cb"}
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { createComponent as _$createComponent, memo as _$memo, mergeProps as _$mergeProps } from "@alloy-js/core/jsx-runtime";
|
|
2
2
|
import * as ay from "@alloy-js/core";
|
|
3
3
|
import * as ts from "@alloy-js/typescript";
|
|
4
|
-
import {
|
|
4
|
+
import { useTsp } from "@typespec/emitter-framework";
|
|
5
5
|
import { JsonAdditionalPropertiesTransform } from "./json-model-additional-properties-transform.js";
|
|
6
6
|
import { JsonModelPropertyTransform } from "./json-model-property-transform.js";
|
|
7
7
|
import { JsonRecordTransformDeclaration } from "./json-record-transform.js";
|
|
8
8
|
import { getJsonTransformDiscriminatorRefkey, JsonTransformDiscriminatorDeclaration } from "./json-transform-discriminator.js";
|
|
9
9
|
export function JsonModelTransform(props) {
|
|
10
|
+
const {
|
|
11
|
+
$
|
|
12
|
+
} = useTsp();
|
|
10
13
|
// Need to skip never properties
|
|
11
14
|
const properties = Array.from($.model.getProperties(props.type, {
|
|
12
15
|
includeExtended: true
|
|
@@ -48,6 +51,9 @@ export function getJsonModelTransformRefkey(type, target) {
|
|
|
48
51
|
return ay.refkey(type, "json_model_transform", target);
|
|
49
52
|
}
|
|
50
53
|
export function JsonModelTransformDeclaration(props) {
|
|
54
|
+
const {
|
|
55
|
+
$
|
|
56
|
+
} = useTsp();
|
|
51
57
|
const namePolicy = ts.useTSNamePolicy();
|
|
52
58
|
const transformName = namePolicy.getName(`json_${props.type.name}_to_${props.target}_transform`, "function");
|
|
53
59
|
const returnType = props.target === "transport" ? "any" : ay.refkey(props.type);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json-record-transform.d.ts","sourceRoot":"","sources":["../../../../../src/components/transforms/json/json-record-transform.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAGrC,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAI3C,MAAM,WAAW,wBAAwB;IACvC,OAAO,EAAE,EAAE,CAAC,MAAM,GAAG,EAAE,CAAC,QAAQ,CAAC;IACjC,IAAI,EAAE,KAAK,CAAC;IACZ,MAAM,EAAE,WAAW,GAAG,aAAa,CAAC;CACrC;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,wBAAwB,
|
|
1
|
+
{"version":3,"file":"json-record-transform.d.ts","sourceRoot":"","sources":["../../../../../src/components/transforms/json/json-record-transform.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAGrC,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAI3C,MAAM,WAAW,wBAAwB;IACvC,OAAO,EAAE,EAAE,CAAC,MAAM,GAAG,EAAE,CAAC,QAAQ,CAAC;IACjC,IAAI,EAAE,KAAK,CAAC;IACZ,MAAM,EAAE,WAAW,GAAG,aAAa,CAAC;CACrC;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,wBAAwB,eAuBlE;AAED,wBAAgB,4BAA4B,CAC1C,IAAI,EAAE,KAAK,EACX,MAAM,EAAE,WAAW,GAAG,aAAa,GAClC,EAAE,CAAC,MAAM,CAEX;AAED,MAAM,WAAW,mCAAmC;IAClD,IAAI,EAAE,KAAK,CAAC;IACZ,MAAM,EAAE,WAAW,GAAG,aAAa,CAAC;CACrC;AAED,wBAAgB,8BAA8B,CAAC,KAAK,EAAE,mCAAmC,eAqCxF"}
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { createComponent as _$createComponent, mergeProps as _$mergeProps } from "@alloy-js/core/jsx-runtime";
|
|
2
2
|
import * as ay from "@alloy-js/core";
|
|
3
3
|
import * as ts from "@alloy-js/typescript";
|
|
4
|
-
import {
|
|
4
|
+
import { useTsp } from "@typespec/emitter-framework";
|
|
5
5
|
import { JsonTransform } from "./json-transform.js";
|
|
6
6
|
export function JsonRecordTransform(props) {
|
|
7
|
+
const {
|
|
8
|
+
$
|
|
9
|
+
} = useTsp();
|
|
7
10
|
if (!$.record.is(props.type)) {
|
|
8
11
|
return null;
|
|
9
12
|
}
|
|
@@ -35,6 +38,9 @@ export function getJsonRecordTransformRefkey(type, target) {
|
|
|
35
38
|
return ay.refkey(type, "json_record_transform", target);
|
|
36
39
|
}
|
|
37
40
|
export function JsonRecordTransformDeclaration(props) {
|
|
41
|
+
const {
|
|
42
|
+
$
|
|
43
|
+
} = useTsp();
|
|
38
44
|
if (!$.record.is(props.type)) {
|
|
39
45
|
return null;
|
|
40
46
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json-transform-discriminator.d.ts","sourceRoot":"","sources":["../../../../../src/components/transforms/json/json-transform-discriminator.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAErC,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAIjE,MAAM,WAAW,+BAA+B;IAC9C,OAAO,EAAE,EAAE,CAAC,MAAM,GAAG,EAAE,CAAC,QAAQ,CAAC;IACjC,aAAa,EAAE,aAAa,CAAC;IAC7B,IAAI,EAAE,KAAK,GAAG,KAAK,CAAC;IACpB,MAAM,EAAE,aAAa,GAAG,WAAW,CAAC;CACrC;AAED,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,+BAA+B,
|
|
1
|
+
{"version":3,"file":"json-transform-discriminator.d.ts","sourceRoot":"","sources":["../../../../../src/components/transforms/json/json-transform-discriminator.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAErC,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAIjE,MAAM,WAAW,+BAA+B;IAC9C,OAAO,EAAE,EAAE,CAAC,MAAM,GAAG,EAAE,CAAC,QAAQ,CAAC;IACjC,aAAa,EAAE,aAAa,CAAC;IAC7B,IAAI,EAAE,KAAK,GAAG,KAAK,CAAC;IACpB,MAAM,EAAE,aAAa,GAAG,WAAW,CAAC;CACrC;AAED,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,+BAA+B,eAmChF;AAED,wBAAgB,mCAAmC,CACjD,IAAI,EAAE,KAAK,GAAG,KAAK,EACnB,MAAM,EAAE,aAAa,GAAG,WAAW,aAGpC;AAED,MAAM,WAAW,0CAA0C;IACzD,IAAI,EAAE,KAAK,GAAG,KAAK,CAAC;IACpB,MAAM,EAAE,aAAa,GAAG,WAAW,CAAC;CACrC;AAED,wBAAgB,qCAAqC,CACnD,KAAK,EAAE,0CAA0C,eAuClD"}
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { createComponent as _$createComponent, memo as _$memo, mergeProps as _$mergeProps } from "@alloy-js/core/jsx-runtime";
|
|
2
2
|
import * as ay from "@alloy-js/core";
|
|
3
3
|
import * as ts from "@alloy-js/typescript";
|
|
4
|
-
import {
|
|
4
|
+
import { useTsp } from "@typespec/emitter-framework";
|
|
5
5
|
import { JsonTransform } from "./json-transform.js";
|
|
6
6
|
export function JsonTransformDiscriminator(props) {
|
|
7
|
+
const {
|
|
8
|
+
$
|
|
9
|
+
} = useTsp();
|
|
7
10
|
const discriminatedUnion = $.model.is(props.type) ? $.model.getDiscriminatedUnion(props.type) : $.union.getDiscriminatedUnion(props.type);
|
|
8
11
|
const propertyName = props.discriminator.propertyName;
|
|
9
12
|
if (!discriminatedUnion || !propertyName) {
|
|
@@ -35,6 +38,9 @@ export function getJsonTransformDiscriminatorRefkey(type, target) {
|
|
|
35
38
|
return ay.refkey(type, "json_transform_discriminator_", target);
|
|
36
39
|
}
|
|
37
40
|
export function JsonTransformDiscriminatorDeclaration(props) {
|
|
41
|
+
const {
|
|
42
|
+
$
|
|
43
|
+
} = useTsp();
|
|
38
44
|
const discriminator = $.type.getDiscriminator(props.type);
|
|
39
45
|
if (!discriminator) {
|
|
40
46
|
return null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json-transform.d.ts","sourceRoot":"","sources":["../../../../../src/components/transforms/json/json-transform.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAyB1C,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,EAAE,CAAC,MAAM,GAAG,EAAE,CAAC,QAAQ,CAAC;IACjC,IAAI,EAAE,IAAI,CAAC;IACX,MAAM,EAAE,WAAW,GAAG,aAAa,CAAC;CACrC;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,
|
|
1
|
+
{"version":3,"file":"json-transform.d.ts","sourceRoot":"","sources":["../../../../../src/components/transforms/json/json-transform.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAyB1C,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,EAAE,CAAC,MAAM,GAAG,EAAE,CAAC,QAAQ,CAAC;IACjC,IAAI,EAAE,IAAI,CAAC;IACX,MAAM,EAAE,WAAW,GAAG,aAAa,CAAC;CACrC;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,eAkCtD;AAED,MAAM,WAAW,6BAA6B;IAC5C,IAAI,EAAE,IAAI,CAAC;IACX,MAAM,EAAE,WAAW,GAAG,aAAa,CAAC;CACrC;AAED,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,6BAA6B,eAqB5E"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createComponent as _$createComponent } from "@alloy-js/core/jsx-runtime";
|
|
2
2
|
import * as ay from "@alloy-js/core";
|
|
3
|
-
import {
|
|
3
|
+
import { useTsp } from "@typespec/emitter-framework";
|
|
4
4
|
import { ScalarDataTransform } from "../data-transform.js";
|
|
5
5
|
import { getJsonArrayTransformRefkey, JsonArrayTransform, JsonArrayTransformDeclaration } from "./json-array-transform.js";
|
|
6
6
|
import { JsonModelPropertyTransform } from "./json-model-property-transform.js";
|
|
@@ -8,6 +8,9 @@ import { getJsonModelTransformRefkey, JsonModelTransform, JsonModelTransformDecl
|
|
|
8
8
|
import { getJsonRecordTransformRefkey, JsonRecordTransform, JsonRecordTransformDeclaration } from "./json-record-transform.js";
|
|
9
9
|
import { getJsonUnionTransformRefkey, JsonUnionTransform, JsonUnionTransformDeclaration } from "./union-transform.js";
|
|
10
10
|
export function JsonTransform(props) {
|
|
11
|
+
const {
|
|
12
|
+
$
|
|
13
|
+
} = useTsp();
|
|
11
14
|
const type = $.httpPart.unpack(props.type) ?? props.type;
|
|
12
15
|
const declaredTransform = getTransformReference(type, props.target);
|
|
13
16
|
if (declaredTransform) {
|
|
@@ -87,6 +90,9 @@ export function JsonTransform(props) {
|
|
|
87
90
|
}
|
|
88
91
|
}
|
|
89
92
|
export function JsonTransformDeclaration(props) {
|
|
93
|
+
const {
|
|
94
|
+
$
|
|
95
|
+
} = useTsp();
|
|
90
96
|
if (!$.model.is(props.type) && !$.union.is(props.type)) {
|
|
91
97
|
return null;
|
|
92
98
|
}
|
|
@@ -132,6 +138,9 @@ export function JsonTransformDeclaration(props) {
|
|
|
132
138
|
}
|
|
133
139
|
}
|
|
134
140
|
function getTransformReference(type, target) {
|
|
141
|
+
const {
|
|
142
|
+
$
|
|
143
|
+
} = useTsp();
|
|
135
144
|
if (type.kind === "Model" && Boolean(type.name)) {
|
|
136
145
|
if ($.array.is(type)) {
|
|
137
146
|
return getJsonArrayTransformRefkey(type, target);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"union-transform.d.ts","sourceRoot":"","sources":["../../../../../src/components/transforms/json/union-transform.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAErC,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAQ3C,MAAM,WAAW,uBAAuB;IACtC,OAAO,EAAE,EAAE,CAAC,MAAM,GAAG,EAAE,CAAC,QAAQ,CAAC;IACjC,IAAI,EAAE,KAAK,CAAC;IACZ,MAAM,EAAE,WAAW,GAAG,aAAa,CAAC;CACrC;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,uBAAuB,
|
|
1
|
+
{"version":3,"file":"union-transform.d.ts","sourceRoot":"","sources":["../../../../../src/components/transforms/json/union-transform.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAErC,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAQ3C,MAAM,WAAW,uBAAuB;IACtC,OAAO,EAAE,EAAE,CAAC,MAAM,GAAG,EAAE,CAAC,QAAQ,CAAC;IACjC,IAAI,EAAE,KAAK,CAAC;IACZ,MAAM,EAAE,WAAW,GAAG,aAAa,CAAC;CACrC;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,uBAAuB,eAoBhE;AAED,wBAAgB,2BAA2B,CACzC,IAAI,EAAE,KAAK,EACX,MAAM,EAAE,WAAW,GAAG,aAAa,GAClC,EAAE,CAAC,MAAM,CAEX;AACD,MAAM,WAAW,kCAAkC;IACjD,IAAI,EAAE,KAAK,CAAC;IACZ,MAAM,EAAE,WAAW,GAAG,aAAa,CAAC;CACrC;AAED,wBAAgB,6BAA6B,CAAC,KAAK,EAAE,kCAAkC,eAoCtF"}
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { memo as _$memo, mergeProps as _$mergeProps, createComponent as _$createComponent } from "@alloy-js/core/jsx-runtime";
|
|
2
2
|
import * as ay from "@alloy-js/core";
|
|
3
3
|
import * as ts from "@alloy-js/typescript";
|
|
4
|
-
import {
|
|
4
|
+
import { useTsp } from "@typespec/emitter-framework";
|
|
5
5
|
import { getJsonTransformDiscriminatorRefkey, JsonTransformDiscriminatorDeclaration } from "./json-transform-discriminator.js";
|
|
6
6
|
import { JsonTransform } from "./json-transform.js";
|
|
7
7
|
export function JsonUnionTransform(props) {
|
|
8
|
+
const {
|
|
9
|
+
$
|
|
10
|
+
} = useTsp();
|
|
8
11
|
const discriminator = $.type.getDiscriminator(props.type);
|
|
9
12
|
if (discriminator) {
|
|
10
13
|
// return <JsonTransformDiscriminator {...props} discriminator={discriminator}/>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import { Type } from "@typespec/compiler";
|
|
2
|
-
|
|
2
|
+
import type { Typekit } from "@typespec/compiler/experimental/typekit";
|
|
3
|
+
export declare function getJsonTransportName($: Typekit, type: Type): string;
|
|
3
4
|
//# sourceMappingURL=transport-namer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transport-namer.d.ts","sourceRoot":"","sources":["../../../../../../src/components/transforms/json/utils/transport-namer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"transport-namer.d.ts","sourceRoot":"","sources":["../../../../../../src/components/transforms/json/utils/transport-namer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yCAAyC,CAAC;AAGvE,wBAAgB,oBAAoB,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,UAO1D"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { $ } from "@typespec/compiler/experimental/typekit";
|
|
2
1
|
import { reportDiagnostic } from "../../../../lib.js";
|
|
3
|
-
export function getJsonTransportName(type) {
|
|
2
|
+
export function getJsonTransportName($, type) {
|
|
4
3
|
if (!("name" in type)) {
|
|
5
4
|
reportDiagnostic($.program, {
|
|
6
5
|
code: "no-name-type",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"multipart-transform.d.ts","sourceRoot":"","sources":["../../../../../src/components/transforms/multipart/multipart-transform.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"multipart-transform.d.ts","sourceRoot":"","sources":["../../../../../src/components/transforms/multipart/multipart-transform.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAErC,OAAO,EAAE,0BAA0B,EAAE,MAAM,gBAAgB,CAAC;AAI5D,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,0BAA0B,CAAC;CAClC;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,uBAAuB,eAmBhE"}
|