@typespec/emitter-framework 0.15.0-dev.3 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -16
- package/dist/src/python/builtins.d.ts +14 -0
- package/dist/src/python/builtins.d.ts.map +1 -0
- package/dist/src/python/builtins.js +29 -0
- package/dist/src/python/builtins.js.map +1 -0
- package/dist/src/python/components/array-expression/array-expression.d.ts +6 -0
- package/dist/src/python/components/array-expression/array-expression.d.ts.map +1 -0
- package/dist/src/python/components/array-expression/array-expression.js +11 -0
- package/dist/src/python/components/array-expression/array-expression.js.map +1 -0
- package/dist/src/python/components/array-expression/array-expression.test.d.ts +2 -0
- package/dist/src/python/components/array-expression/array-expression.test.d.ts.map +1 -0
- package/dist/src/python/components/array-expression/array-expression.test.js +19 -0
- package/dist/src/python/components/array-expression/array-expression.test.js.map +1 -0
- package/dist/src/python/components/array-expression/index.d.ts +2 -0
- package/dist/src/python/components/array-expression/index.d.ts.map +1 -0
- package/dist/src/python/components/array-expression/index.js +2 -0
- package/dist/src/python/components/array-expression/index.js.map +1 -0
- package/dist/src/python/components/atom/atom.d.ts +33 -0
- package/dist/src/python/components/atom/atom.d.ts.map +1 -0
- package/dist/src/python/components/atom/atom.js +88 -0
- package/dist/src/python/components/atom/atom.js.map +1 -0
- package/dist/src/python/components/atom/atom.test.d.ts +2 -0
- package/dist/src/python/components/atom/atom.test.d.ts.map +1 -0
- package/dist/src/python/components/atom/atom.test.js +224 -0
- package/dist/src/python/components/atom/atom.test.js.map +1 -0
- package/dist/src/python/components/atom/index.d.ts +2 -0
- package/dist/src/python/components/atom/index.d.ts.map +1 -0
- package/dist/src/python/components/atom/index.js +2 -0
- package/dist/src/python/components/atom/index.js.map +1 -0
- package/dist/src/python/components/class-declaration/class-bases.d.ts +45 -0
- package/dist/src/python/components/class-declaration/class-bases.d.ts.map +1 -0
- package/dist/src/python/components/class-declaration/class-bases.js +84 -0
- package/dist/src/python/components/class-declaration/class-bases.js.map +1 -0
- package/dist/src/python/components/class-declaration/class-body.d.ts +16 -0
- package/dist/src/python/components/class-declaration/class-body.d.ts.map +1 -0
- package/dist/src/python/components/class-declaration/class-body.js +52 -0
- package/dist/src/python/components/class-declaration/class-body.js.map +1 -0
- package/dist/src/python/components/class-declaration/class-declaration.d.ts +23 -0
- package/dist/src/python/components/class-declaration/class-declaration.d.ts.map +1 -0
- package/dist/src/python/components/class-declaration/class-declaration.js +118 -0
- package/dist/src/python/components/class-declaration/class-declaration.js.map +1 -0
- package/dist/src/python/components/class-declaration/class-declaration.test.d.ts +2 -0
- package/dist/src/python/components/class-declaration/class-declaration.test.d.ts.map +1 -0
- package/dist/src/python/components/class-declaration/class-declaration.test.js +1527 -0
- package/dist/src/python/components/class-declaration/class-declaration.test.js.map +1 -0
- package/dist/src/python/components/class-declaration/class-member.d.ts +16 -0
- package/dist/src/python/components/class-declaration/class-member.d.ts.map +1 -0
- package/dist/src/python/components/class-declaration/class-member.js +71 -0
- package/dist/src/python/components/class-declaration/class-member.js.map +1 -0
- package/dist/src/python/components/class-declaration/class-member.test.d.ts +2 -0
- package/dist/src/python/components/class-declaration/class-member.test.d.ts.map +1 -0
- package/dist/src/python/components/class-declaration/class-member.test.js +202 -0
- package/dist/src/python/components/class-declaration/class-member.test.js.map +1 -0
- package/dist/src/python/components/class-declaration/class-method.d.ts +22 -0
- package/dist/src/python/components/class-declaration/class-method.d.ts.map +1 -0
- package/dist/src/python/components/class-declaration/class-method.js +76 -0
- package/dist/src/python/components/class-declaration/class-method.js.map +1 -0
- package/dist/src/python/components/class-declaration/class-method.test.d.ts +2 -0
- package/dist/src/python/components/class-declaration/class-method.test.d.ts.map +1 -0
- package/dist/src/python/components/class-declaration/class-method.test.js +298 -0
- package/dist/src/python/components/class-declaration/class-method.test.js.map +1 -0
- package/dist/src/python/components/class-declaration/index.d.ts +7 -0
- package/dist/src/python/components/class-declaration/index.d.ts.map +1 -0
- package/dist/src/python/components/class-declaration/index.js +7 -0
- package/dist/src/python/components/class-declaration/index.js.map +1 -0
- package/dist/src/python/components/class-declaration/primitive-initializer.d.ts +22 -0
- package/dist/src/python/components/class-declaration/primitive-initializer.d.ts.map +1 -0
- package/dist/src/python/components/class-declaration/primitive-initializer.js +67 -0
- package/dist/src/python/components/class-declaration/primitive-initializer.js.map +1 -0
- package/dist/src/python/components/doc-element/doc-element.d.ts +46 -0
- package/dist/src/python/components/doc-element/doc-element.d.ts.map +1 -0
- package/dist/src/python/components/doc-element/doc-element.js +59 -0
- package/dist/src/python/components/doc-element/doc-element.js.map +1 -0
- package/dist/src/python/components/doc-element/index.d.ts +2 -0
- package/dist/src/python/components/doc-element/index.d.ts.map +1 -0
- package/dist/src/python/components/doc-element/index.js +2 -0
- package/dist/src/python/components/doc-element/index.js.map +1 -0
- package/dist/src/python/components/enum-declaration/enum-declaration.d.ts +8 -0
- package/dist/src/python/components/enum-declaration/enum-declaration.d.ts.map +1 -0
- package/dist/src/python/components/enum-declaration/enum-declaration.js +80 -0
- package/dist/src/python/components/enum-declaration/enum-declaration.js.map +1 -0
- package/dist/src/python/components/enum-declaration/enum-declaration.test.d.ts +2 -0
- package/dist/src/python/components/enum-declaration/enum-declaration.test.d.ts.map +1 -0
- package/dist/src/python/components/enum-declaration/enum-declaration.test.js +344 -0
- package/dist/src/python/components/enum-declaration/enum-declaration.test.js.map +1 -0
- package/dist/src/python/components/enum-declaration/enum-member.d.ts +9 -0
- package/dist/src/python/components/enum-declaration/enum-member.d.ts.map +1 -0
- package/dist/src/python/components/enum-declaration/enum-member.js +22 -0
- package/dist/src/python/components/enum-declaration/enum-member.js.map +1 -0
- package/dist/src/python/components/enum-declaration/index.d.ts +3 -0
- package/dist/src/python/components/enum-declaration/index.d.ts.map +1 -0
- package/dist/src/python/components/enum-declaration/index.js +3 -0
- package/dist/src/python/components/enum-declaration/index.js.map +1 -0
- package/dist/src/python/components/function-declaration/function-declaration.d.ts +24 -0
- package/dist/src/python/components/function-declaration/function-declaration.d.ts.map +1 -0
- package/dist/src/python/components/function-declaration/function-declaration.js +68 -0
- package/dist/src/python/components/function-declaration/function-declaration.js.map +1 -0
- package/dist/src/python/components/function-declaration/function-declaration.test.d.ts +2 -0
- package/dist/src/python/components/function-declaration/function-declaration.test.d.ts.map +1 -0
- package/dist/src/python/components/function-declaration/function-declaration.test.js +682 -0
- package/dist/src/python/components/function-declaration/function-declaration.test.js.map +1 -0
- package/dist/src/python/components/function-declaration/index.d.ts +2 -0
- package/dist/src/python/components/function-declaration/index.d.ts.map +1 -0
- package/dist/src/python/components/function-declaration/index.js +2 -0
- package/dist/src/python/components/function-declaration/index.js.map +1 -0
- package/dist/src/python/components/index.d.ts +12 -0
- package/dist/src/python/components/index.d.ts.map +1 -0
- package/dist/src/python/components/index.js +12 -0
- package/dist/src/python/components/index.js.map +1 -0
- package/dist/src/python/components/protocol-declaration/callable-parameters.d.ts +25 -0
- package/dist/src/python/components/protocol-declaration/callable-parameters.d.ts.map +1 -0
- package/dist/src/python/components/protocol-declaration/callable-parameters.js +33 -0
- package/dist/src/python/components/protocol-declaration/callable-parameters.js.map +1 -0
- package/dist/src/python/components/protocol-declaration/index.d.ts +3 -0
- package/dist/src/python/components/protocol-declaration/index.d.ts.map +1 -0
- package/dist/src/python/components/protocol-declaration/index.js +3 -0
- package/dist/src/python/components/protocol-declaration/index.js.map +1 -0
- package/dist/src/python/components/protocol-declaration/protocol-declaration.d.ts +8 -0
- package/dist/src/python/components/protocol-declaration/protocol-declaration.d.ts.map +1 -0
- package/dist/src/python/components/protocol-declaration/protocol-declaration.js +86 -0
- package/dist/src/python/components/protocol-declaration/protocol-declaration.js.map +1 -0
- package/dist/src/python/components/protocol-declaration/protocol-declaration.test.d.ts +2 -0
- package/dist/src/python/components/protocol-declaration/protocol-declaration.test.d.ts.map +1 -0
- package/dist/src/python/components/protocol-declaration/protocol-declaration.test.js +117 -0
- package/dist/src/python/components/protocol-declaration/protocol-declaration.test.js.map +1 -0
- package/dist/src/python/components/record-expression/index.d.ts +2 -0
- package/dist/src/python/components/record-expression/index.d.ts.map +1 -0
- package/dist/src/python/components/record-expression/index.js +2 -0
- package/dist/src/python/components/record-expression/index.js.map +1 -0
- package/dist/src/python/components/record-expression/record-expression.d.ts +6 -0
- package/dist/src/python/components/record-expression/record-expression.d.ts.map +1 -0
- package/dist/src/python/components/record-expression/record-expression.js +13 -0
- package/dist/src/python/components/record-expression/record-expression.js.map +1 -0
- package/dist/src/python/components/record-expression/record-expression.test.d.ts +2 -0
- package/dist/src/python/components/record-expression/record-expression.test.d.ts.map +1 -0
- package/dist/src/python/components/record-expression/record-expression.test.js +19 -0
- package/dist/src/python/components/record-expression/record-expression.test.js.map +1 -0
- package/dist/src/python/components/type-alias-declaration/index.d.ts +2 -0
- package/dist/src/python/components/type-alias-declaration/index.d.ts.map +1 -0
- package/dist/src/python/components/type-alias-declaration/index.js +2 -0
- package/dist/src/python/components/type-alias-declaration/index.js.map +1 -0
- package/dist/src/python/components/type-alias-declaration/type-alias-declaration.d.ts +16 -0
- package/dist/src/python/components/type-alias-declaration/type-alias-declaration.d.ts.map +1 -0
- package/dist/src/python/components/type-alias-declaration/type-alias-declaration.js +75 -0
- package/dist/src/python/components/type-alias-declaration/type-alias-declaration.js.map +1 -0
- package/dist/src/python/components/type-alias-declaration/type-alias-declaration.test.d.ts +2 -0
- package/dist/src/python/components/type-alias-declaration/type-alias-declaration.test.d.ts.map +1 -0
- package/dist/src/python/components/type-alias-declaration/type-alias-declaration.test.js +140 -0
- package/dist/src/python/components/type-alias-declaration/type-alias-declaration.test.js.map +1 -0
- package/dist/src/python/components/type-declaration/index.d.ts +2 -0
- package/dist/src/python/components/type-declaration/index.d.ts.map +1 -0
- package/dist/src/python/components/type-declaration/index.js +2 -0
- package/dist/src/python/components/type-declaration/index.js.map +1 -0
- package/dist/src/python/components/type-declaration/type-declaration.d.ts +11 -0
- package/dist/src/python/components/type-declaration/type-declaration.d.ts.map +1 -0
- package/dist/src/python/components/type-declaration/type-declaration.js +31 -0
- package/dist/src/python/components/type-declaration/type-declaration.js.map +1 -0
- package/dist/src/python/components/type-declaration/type-declaration.test.d.ts +2 -0
- package/dist/src/python/components/type-declaration/type-declaration.test.d.ts.map +1 -0
- package/dist/src/python/components/type-declaration/type-declaration.test.js +69 -0
- package/dist/src/python/components/type-declaration/type-declaration.test.js.map +1 -0
- package/dist/src/python/components/type-expression/index.d.ts +2 -0
- package/dist/src/python/components/type-expression/index.d.ts.map +1 -0
- package/dist/src/python/components/type-expression/index.js +2 -0
- package/dist/src/python/components/type-expression/index.js.map +1 -0
- package/dist/src/python/components/type-expression/type-expression.d.ts +12 -0
- package/dist/src/python/components/type-expression/type-expression.d.ts.map +1 -0
- package/dist/src/python/components/type-expression/type-expression.js +348 -0
- package/dist/src/python/components/type-expression/type-expression.js.map +1 -0
- package/dist/src/python/components/type-expression/type-expression.test.d.ts +2 -0
- package/dist/src/python/components/type-expression/type-expression.test.d.ts.map +1 -0
- package/dist/src/python/components/type-expression/type-expression.test.js +503 -0
- package/dist/src/python/components/type-expression/type-expression.test.js.map +1 -0
- package/dist/src/python/index.d.ts +4 -0
- package/dist/src/python/index.d.ts.map +1 -0
- package/dist/src/python/index.js +4 -0
- package/dist/src/python/index.js.map +1 -0
- package/dist/src/python/lib.d.ts +68 -0
- package/dist/src/python/lib.d.ts.map +1 -0
- package/dist/src/python/lib.js +38 -0
- package/dist/src/python/lib.js.map +1 -0
- package/dist/src/python/test-utils.d.ts +8 -0
- package/dist/src/python/test-utils.d.ts.map +1 -0
- package/dist/src/python/test-utils.js +25 -0
- package/dist/src/python/test-utils.js.map +1 -0
- package/dist/src/python/utils/index.d.ts +4 -0
- package/dist/src/python/utils/index.d.ts.map +1 -0
- package/dist/src/python/utils/index.js +4 -0
- package/dist/src/python/utils/index.js.map +1 -0
- package/dist/src/python/utils/operation.d.ts +27 -0
- package/dist/src/python/utils/operation.d.ts.map +1 -0
- package/dist/src/python/utils/operation.js +139 -0
- package/dist/src/python/utils/operation.js.map +1 -0
- package/dist/src/python/utils/refkey.d.ts +23 -0
- package/dist/src/python/utils/refkey.d.ts.map +1 -0
- package/dist/src/python/utils/refkey.js +36 -0
- package/dist/src/python/utils/refkey.js.map +1 -0
- package/dist/src/python/utils/type.d.ts +19 -0
- package/dist/src/python/utils/type.d.ts.map +1 -0
- package/dist/src/python/utils/type.js +24 -0
- package/dist/src/python/utils/type.js.map +1 -0
- package/package.json +12 -5
- package/package.json.bak +14 -6
- package/src/python/builtins.ts +43 -0
- package/src/python/components/array-expression/array-expression.test.tsx +14 -0
- package/src/python/components/array-expression/array-expression.tsx +11 -0
- package/src/python/components/array-expression/index.ts +1 -0
- package/src/python/components/atom/atom.test.tsx +244 -0
- package/src/python/components/atom/atom.tsx +95 -0
- package/src/python/components/atom/index.ts +1 -0
- package/src/python/components/class-declaration/class-bases.tsx +92 -0
- package/src/python/components/class-declaration/class-body.tsx +56 -0
- package/src/python/components/class-declaration/class-declaration.test.tsx +1414 -0
- package/src/python/components/class-declaration/class-declaration.tsx +116 -0
- package/src/python/components/class-declaration/class-member.test.tsx +194 -0
- package/src/python/components/class-declaration/class-member.tsx +67 -0
- package/src/python/components/class-declaration/class-method.test.tsx +250 -0
- package/src/python/components/class-declaration/class-method.tsx +97 -0
- package/src/python/components/class-declaration/index.ts +6 -0
- package/src/python/components/class-declaration/primitive-initializer.tsx +62 -0
- package/src/python/components/doc-element/doc-element.tsx +83 -0
- package/src/python/components/doc-element/index.ts +1 -0
- package/src/python/components/enum-declaration/enum-declaration.test.tsx +319 -0
- package/src/python/components/enum-declaration/enum-declaration.tsx +77 -0
- package/src/python/components/enum-declaration/enum-member.tsx +21 -0
- package/src/python/components/enum-declaration/index.ts +2 -0
- package/src/python/components/function-declaration/function-declaration.test.tsx +582 -0
- package/src/python/components/function-declaration/function-declaration.tsx +90 -0
- package/src/python/components/function-declaration/index.ts +1 -0
- package/src/python/components/index.ts +11 -0
- package/src/python/components/protocol-declaration/callable-parameters.tsx +44 -0
- package/src/python/components/protocol-declaration/index.ts +2 -0
- package/src/python/components/protocol-declaration/protocol-declaration.test.tsx +106 -0
- package/src/python/components/protocol-declaration/protocol-declaration.tsx +73 -0
- package/src/python/components/record-expression/index.ts +1 -0
- package/src/python/components/record-expression/record-expression.test.tsx +14 -0
- package/src/python/components/record-expression/record-expression.tsx +13 -0
- package/src/python/components/type-alias-declaration/index.ts +1 -0
- package/src/python/components/type-alias-declaration/type-alias-declaration.test.tsx +117 -0
- package/src/python/components/type-alias-declaration/type-alias-declaration.tsx +67 -0
- package/src/python/components/type-declaration/index.ts +1 -0
- package/src/python/components/type-declaration/type-declaration.test.tsx +58 -0
- package/src/python/components/type-declaration/type-declaration.tsx +26 -0
- package/src/python/components/type-expression/index.ts +1 -0
- package/src/python/components/type-expression/type-expression.test.tsx +463 -0
- package/src/python/components/type-expression/type-expression.tsx +333 -0
- package/src/python/index.ts +3 -0
- package/src/python/lib.ts +40 -0
- package/src/python/test-utils.tsx +31 -0
- package/src/python/utils/index.ts +3 -0
- package/src/python/utils/operation.ts +161 -0
- package/src/python/utils/refkey.ts +36 -0
- package/src/python/utils/type.ts +31 -0
|
@@ -0,0 +1,348 @@
|
|
|
1
|
+
import { createComponent as _$createComponent, memo as _$memo } from "@alloy-js/core/jsx-runtime";
|
|
2
|
+
import { Experimental_OverridableComponent } from "#core/components/index.js";
|
|
3
|
+
import { useTsp } from "#core/context/index.js";
|
|
4
|
+
import { reportPythonDiagnostic } from "#python/lib.js";
|
|
5
|
+
import { code, For, List, mapJoin } from "@alloy-js/core";
|
|
6
|
+
import * as py from "@alloy-js/python";
|
|
7
|
+
import { isNeverType } from "@typespec/compiler";
|
|
8
|
+
import { datetimeModule, decimalModule, typingModule } from "../../builtins.js";
|
|
9
|
+
import { efRefkey } from "../../utils/refkey.js";
|
|
10
|
+
import { ArrayExpression } from "../array-expression/array-expression.js";
|
|
11
|
+
import { RecordExpression } from "../record-expression/record-expression.js";
|
|
12
|
+
export function TypeExpression(props) {
|
|
13
|
+
const {
|
|
14
|
+
$
|
|
15
|
+
} = useTsp();
|
|
16
|
+
const type = props.type;
|
|
17
|
+
if (!props.noReference && isDeclaration($, type)) {
|
|
18
|
+
return _$createComponent(Experimental_OverridableComponent, {
|
|
19
|
+
reference: true,
|
|
20
|
+
type: type,
|
|
21
|
+
get children() {
|
|
22
|
+
return _$createComponent(py.Reference, {
|
|
23
|
+
get refkey() {
|
|
24
|
+
return efRefkey(type);
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
switch (type.kind) {
|
|
31
|
+
case "Scalar": // Custom types based on primitives (Intrinsics)
|
|
32
|
+
case "Intrinsic":
|
|
33
|
+
// Language primitives like `string`, `number`, etc.
|
|
34
|
+
if (isNeverType(type)) {
|
|
35
|
+
return typingModule["."]["Never"];
|
|
36
|
+
}
|
|
37
|
+
return [_$memo(() => getScalarIntrinsicExpression($, type))];
|
|
38
|
+
case "Boolean":
|
|
39
|
+
case "Number":
|
|
40
|
+
case "String":
|
|
41
|
+
// Single literal values are wrapped in Literal[...]
|
|
42
|
+
return [_$memo(() => typingModule["."]["Literal"]), "[", _$memo(() => formatLiteralValue(type)), "]"];
|
|
43
|
+
case "Tuple":
|
|
44
|
+
return ["tuple[", _$createComponent(For, {
|
|
45
|
+
get each() {
|
|
46
|
+
return type.values;
|
|
47
|
+
},
|
|
48
|
+
comma: true,
|
|
49
|
+
space: true,
|
|
50
|
+
children: element => _$createComponent(TypeExpression, {
|
|
51
|
+
type: element
|
|
52
|
+
})
|
|
53
|
+
}), "]"];
|
|
54
|
+
case "Union":
|
|
55
|
+
{
|
|
56
|
+
const variants = Array.from(type.variants?.values?.() ?? []);
|
|
57
|
+
|
|
58
|
+
// Check if all variants are literals or named union variant refs with literal values
|
|
59
|
+
const isLiteralOrVariantRef = t => {
|
|
60
|
+
if (!t) return false;
|
|
61
|
+
if (isLiteral($, t)) return true;
|
|
62
|
+
// Named union variant with a literal inner value
|
|
63
|
+
if (t.kind === "UnionVariant" && t.union?.name) {
|
|
64
|
+
return isLiteral($, t.type);
|
|
65
|
+
}
|
|
66
|
+
return false;
|
|
67
|
+
};
|
|
68
|
+
const innerTypes = variants.map(v => v.type);
|
|
69
|
+
if (innerTypes.every(isLiteralOrVariantRef)) {
|
|
70
|
+
// All literals - render as Literal[...]
|
|
71
|
+
const literalValues = variants.map(v => {
|
|
72
|
+
const innerType = v.type;
|
|
73
|
+
// Named union variant ref with literal value
|
|
74
|
+
if (innerType.kind === "UnionVariant" && innerType.union?.name) {
|
|
75
|
+
const variantName = String(innerType.name).toUpperCase();
|
|
76
|
+
return code`${efRefkey(innerType.union)}.${variantName}`;
|
|
77
|
+
}
|
|
78
|
+
if (isLiteral($, innerType)) {
|
|
79
|
+
return formatLiteralValue(innerType);
|
|
80
|
+
}
|
|
81
|
+
return undefined;
|
|
82
|
+
}).filter(Boolean);
|
|
83
|
+
return [_$memo(() => typingModule["."]["Literal"]), "[", _$createComponent(List, {
|
|
84
|
+
children: literalValues,
|
|
85
|
+
joiner: ", "
|
|
86
|
+
}), "]"];
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// Not all literals - render as union type
|
|
90
|
+
return mapJoin(() => variants, v => _$createComponent(TypeExpression, {
|
|
91
|
+
get type() {
|
|
92
|
+
return v.type;
|
|
93
|
+
}
|
|
94
|
+
}), {
|
|
95
|
+
joiner: " | "
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
case "UnionVariant":
|
|
99
|
+
{
|
|
100
|
+
// Union variant from a named union with a literal value
|
|
101
|
+
if (type.union && type.union.name && isLiteral($, type.type)) {
|
|
102
|
+
// Use the variant's name (e.g., "red", "active"), converted to UPPER_CASE by the enum
|
|
103
|
+
const variantName = String(type.name).toUpperCase();
|
|
104
|
+
return [_$memo(() => typingModule["."]["Literal"]), "[", _$memo(() => efRefkey(type.union)), ".", variantName, "]"];
|
|
105
|
+
}
|
|
106
|
+
// Unnamed union variant or non-literal value, unwrap to its inner type
|
|
107
|
+
return _$createComponent(TypeExpression, {
|
|
108
|
+
get type() {
|
|
109
|
+
return type.type;
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
case "ModelProperty":
|
|
114
|
+
return _$createComponent(TypeExpression, {
|
|
115
|
+
get type() {
|
|
116
|
+
return type.type;
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
case "Model":
|
|
120
|
+
if ($.array.is(type)) {
|
|
121
|
+
const elementType = type.indexer.value;
|
|
122
|
+
return _$createComponent(ArrayExpression, {
|
|
123
|
+
elementType: elementType
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
if ($.record.is(type)) {
|
|
127
|
+
const elementType = type.indexer.value;
|
|
128
|
+
return _$createComponent(RecordExpression, {
|
|
129
|
+
elementType: elementType
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
// TODO: When TypeSpec adds true generics support, handle generic type references here.
|
|
134
|
+
// Currently, TypeSpec templates are macros that expand to concrete types, so template
|
|
135
|
+
// instances (e.g., Response<string>) are treated as regular concrete types, not as
|
|
136
|
+
// parameterized generic types (e.g., Response[str]).
|
|
137
|
+
// When generics are implemented, this is where we would render: ClassName[TypeArg, ...]
|
|
138
|
+
|
|
139
|
+
// Regular named models should be handled as references
|
|
140
|
+
if (type.name) {
|
|
141
|
+
return _$createComponent(Experimental_OverridableComponent, {
|
|
142
|
+
reference: true,
|
|
143
|
+
type: type,
|
|
144
|
+
get children() {
|
|
145
|
+
return _$createComponent(py.Reference, {
|
|
146
|
+
get refkey() {
|
|
147
|
+
return efRefkey(type);
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
reportPythonDiagnostic($.program, {
|
|
154
|
+
code: "python-unsupported-type",
|
|
155
|
+
target: type
|
|
156
|
+
});
|
|
157
|
+
return [];
|
|
158
|
+
case "TemplateParameter":
|
|
159
|
+
return code`${String(type.node.id.sv)}`;
|
|
160
|
+
case "Operation":
|
|
161
|
+
{
|
|
162
|
+
// Render function types as typing.Callable[[ArgTypes...], ReturnType]
|
|
163
|
+
// If parameters cannot be enumerated, fall back to Callable[..., ReturnType]
|
|
164
|
+
let paramTypes = null;
|
|
165
|
+
const op = type;
|
|
166
|
+
if (op.parameters) {
|
|
167
|
+
try {
|
|
168
|
+
const {
|
|
169
|
+
$
|
|
170
|
+
} = useTsp();
|
|
171
|
+
const modelProps = $.model.getProperties(op.parameters);
|
|
172
|
+
paramTypes = Array.from(modelProps.values()).map(p => p.type);
|
|
173
|
+
} catch {
|
|
174
|
+
// Unknown/unsupported params shape
|
|
175
|
+
paramTypes = null;
|
|
176
|
+
}
|
|
177
|
+
} else {
|
|
178
|
+
paramTypes = [];
|
|
179
|
+
}
|
|
180
|
+
return [_$memo(() => typingModule["."]["Callable"]), "[", _$memo(() => paramTypes === null ? ["..."] : paramTypes.length > 0 ? ["[", _$createComponent(For, {
|
|
181
|
+
each: paramTypes,
|
|
182
|
+
comma: true,
|
|
183
|
+
space: true,
|
|
184
|
+
children: t => _$createComponent(TypeExpression, {
|
|
185
|
+
type: t
|
|
186
|
+
})
|
|
187
|
+
}), "]"] : ["[]"]), ", ", _$createComponent(TypeExpression, {
|
|
188
|
+
get type() {
|
|
189
|
+
return type.returnType;
|
|
190
|
+
}
|
|
191
|
+
}), "]"];
|
|
192
|
+
}
|
|
193
|
+
default:
|
|
194
|
+
reportPythonDiagnostic($.program, {
|
|
195
|
+
code: "python-unsupported-type",
|
|
196
|
+
target: type
|
|
197
|
+
});
|
|
198
|
+
// Return empty fragment - the diagnostic has already been reported
|
|
199
|
+
return [];
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* Checks if a type is a literal (string, numeric, or boolean).
|
|
205
|
+
*/
|
|
206
|
+
function isLiteral($, type) {
|
|
207
|
+
return $.literal.isString(type) || $.literal.isNumeric(type) || $.literal.isBoolean(type);
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* Formats a literal type value for use in Python's Literal[...] syntax.
|
|
212
|
+
*/
|
|
213
|
+
function formatLiteralValue(type) {
|
|
214
|
+
switch (type.kind) {
|
|
215
|
+
case "String":
|
|
216
|
+
return JSON.stringify(type.value);
|
|
217
|
+
case "Boolean":
|
|
218
|
+
return type.value ? "True" : "False";
|
|
219
|
+
case "Number":
|
|
220
|
+
return String(type.value);
|
|
221
|
+
default:
|
|
222
|
+
return String(type.value);
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
const intrinsicNameToPythonType = new Map([
|
|
226
|
+
// Core types
|
|
227
|
+
["unknown", "Any"],
|
|
228
|
+
// Matches Python's `Any`
|
|
229
|
+
["string", "str"],
|
|
230
|
+
// Matches Python's `str`
|
|
231
|
+
["boolean", "bool"],
|
|
232
|
+
// Matches Python's `bool`
|
|
233
|
+
["null", "None"],
|
|
234
|
+
// Matches Python's `None`
|
|
235
|
+
["void", "None"],
|
|
236
|
+
// Matches Python's `None`
|
|
237
|
+
["never", "Never"],
|
|
238
|
+
// Matches Python's `Never`
|
|
239
|
+
["bytes", "bytes"],
|
|
240
|
+
// Matches Python's `bytes`
|
|
241
|
+
|
|
242
|
+
// Numeric types
|
|
243
|
+
["numeric", "number"],
|
|
244
|
+
// Parent type for all numeric types
|
|
245
|
+
["integer", "int"],
|
|
246
|
+
// Broad integer category, maps to `int`
|
|
247
|
+
["float", "float"],
|
|
248
|
+
// Broad float category, maps to `float`
|
|
249
|
+
["decimal", "Decimal"],
|
|
250
|
+
// Broad decimal category, maps to `Decimal`
|
|
251
|
+
["decimal128", "Decimal"],
|
|
252
|
+
// 128-bit decimal category, maps to `Decimal`
|
|
253
|
+
["int64", "int"],
|
|
254
|
+
// Use `int` to handle large 64-bit integers
|
|
255
|
+
["int32", "int"],
|
|
256
|
+
// 32-bit integer fits in Python's `int`
|
|
257
|
+
["int16", "int"],
|
|
258
|
+
// 16-bit integer
|
|
259
|
+
["int8", "int"],
|
|
260
|
+
// 8-bit integer
|
|
261
|
+
["safeint", "int"],
|
|
262
|
+
// Safe integer fits within Python limits
|
|
263
|
+
["uint64", "int"],
|
|
264
|
+
// Use `int` for unsigned 64-bit integers
|
|
265
|
+
["uint32", "int"],
|
|
266
|
+
// 32-bit unsigned integer
|
|
267
|
+
["uint16", "int"],
|
|
268
|
+
// 16-bit unsigned integer
|
|
269
|
+
["uint8", "int"],
|
|
270
|
+
// 8-bit unsigned integer
|
|
271
|
+
["float32", "float"],
|
|
272
|
+
// Maps to Python's `float`
|
|
273
|
+
["float64", "float"],
|
|
274
|
+
// Maps to Python's `float`.
|
|
275
|
+
|
|
276
|
+
// Date and time types
|
|
277
|
+
["plainDate", "str"],
|
|
278
|
+
// Use `str` for plain calendar dates
|
|
279
|
+
["plainTime", "str"],
|
|
280
|
+
// Use `str` for plain clock times
|
|
281
|
+
["utcDateTime", "datetime"],
|
|
282
|
+
// Use `datetime` for UTC date-times
|
|
283
|
+
["offsetDateTime", "str"],
|
|
284
|
+
// Use `str` for timezone-specific date-times
|
|
285
|
+
["duration", "str"],
|
|
286
|
+
// Duration as an ISO 8601 string or custom format
|
|
287
|
+
|
|
288
|
+
// String types
|
|
289
|
+
["url", "str"] // Matches Python's `str`
|
|
290
|
+
]);
|
|
291
|
+
const pythonTypeToImport = new Map([["Any", typingModule["."]["Any"]], ["Never", typingModule["."]["Never"]], ["datetime", datetimeModule["."]["datetime"]], ["Decimal", decimalModule["."]["Decimal"]]]);
|
|
292
|
+
function getScalarIntrinsicExpression($, type) {
|
|
293
|
+
let intrinsicName;
|
|
294
|
+
if ($.scalar.is(type)) {
|
|
295
|
+
if ($.scalar.isUtcDateTime(type) || $.scalar.extendsUtcDateTime(type)) {
|
|
296
|
+
const encoding = $.scalar.getEncoding(type);
|
|
297
|
+
intrinsicName = "utcDateTime";
|
|
298
|
+
switch (encoding?.encoding) {
|
|
299
|
+
case "unixTimestamp":
|
|
300
|
+
case "rfc7231":
|
|
301
|
+
case "rfc3339":
|
|
302
|
+
default:
|
|
303
|
+
intrinsicName = `utcDateTime`;
|
|
304
|
+
break;
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
intrinsicName = $.scalar.getStdBase(type)?.name ?? "";
|
|
308
|
+
} else {
|
|
309
|
+
intrinsicName = type.name;
|
|
310
|
+
}
|
|
311
|
+
let pythonType = intrinsicNameToPythonType.get(intrinsicName);
|
|
312
|
+
const importModule = pythonTypeToImport.get(pythonType ?? "");
|
|
313
|
+
pythonType = importModule ? importModule : pythonType;
|
|
314
|
+
if (!pythonType) {
|
|
315
|
+
reportPythonDiagnostic($.program, {
|
|
316
|
+
code: "python-unsupported-scalar",
|
|
317
|
+
target: type
|
|
318
|
+
});
|
|
319
|
+
return "any";
|
|
320
|
+
}
|
|
321
|
+
return pythonType;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
// TODO: When TypeSpec adds true generics support, add helper to detect generic type instances.
|
|
325
|
+
// Currently, TypeSpec templates expand to concrete types at compile time, so we treat all
|
|
326
|
+
// template instances as regular concrete types.
|
|
327
|
+
|
|
328
|
+
function isDeclaration($, type) {
|
|
329
|
+
switch (type.kind) {
|
|
330
|
+
case "Namespace":
|
|
331
|
+
case "Interface":
|
|
332
|
+
case "Enum":
|
|
333
|
+
case "Operation":
|
|
334
|
+
case "EnumMember":
|
|
335
|
+
case "UnionVariant":
|
|
336
|
+
return false;
|
|
337
|
+
case "Model":
|
|
338
|
+
if ($.array.is(type) || $.record.is(type)) {
|
|
339
|
+
return false;
|
|
340
|
+
}
|
|
341
|
+
return Boolean(type.name);
|
|
342
|
+
case "Union":
|
|
343
|
+
return Boolean(type.name);
|
|
344
|
+
default:
|
|
345
|
+
return false;
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
//# sourceMappingURL=type-expression.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Experimental_OverridableComponent","useTsp","reportPythonDiagnostic","code","For","List","mapJoin","py","isNeverType","datetimeModule","decimalModule","typingModule","efRefkey","ArrayExpression","RecordExpression","TypeExpression","props","$","type","noReference","isDeclaration","_$createComponent","reference","children","Reference","refkey","kind","_$memo","getScalarIntrinsicExpression","formatLiteralValue","each","values","comma","space","element","variants","Array","from","isLiteralOrVariantRef","t","isLiteral","union","name","innerTypes","map","v","every","literalValues","innerType","variantName","String","toUpperCase","undefined","filter","Boolean","joiner","array","is","elementType","indexer","value","record","program","target","node","id","sv","paramTypes","op","parameters","modelProps","model","getProperties","p","length","returnType","literal","isString","isNumeric","isBoolean","JSON","stringify","intrinsicNameToPythonType","Map","pythonTypeToImport","intrinsicName","scalar","isUtcDateTime","extendsUtcDateTime","encoding","getEncoding","getStdBase","pythonType","get","importModule"],"sources":["../../../../../src/python/components/type-expression/type-expression.tsx"],"sourcesContent":[null],"mappings":";AAAA,SAASA,iCAAiC,QAAQ,2BAA2B;AAC7E,SAASC,MAAM,QAAQ,wBAAwB;AAC/C,SAASC,sBAAsB,QAAQ,gBAAgB;AACvD,SAASC,IAAI,EAAEC,GAAG,EAAEC,IAAI,EAAEC,OAAO,QAAQ,gBAAgB;AACzD,OAAO,KAAKC,EAAE,MAAM,kBAAkB;AACtC,SACEC,WAAW,QAKN,oBAAoB;AAG3B,SAASC,cAAc,EAAEC,aAAa,EAAEC,YAAY,QAAQ,mBAAmB;AAC/E,SAASC,QAAQ,QAAQ,uBAAuB;AAChD,SAASC,eAAe,QAAQ,yCAAyC;AACzE,SAASC,gBAAgB,QAAQ,2CAA2C;AAa5E,OAAO,SAASC,cAAcA,CAACC,KAA0B,EAAE;EACzD,MAAM;IAAEC;EAAE,CAAC,GAAGhB,MAAM,CAAC,CAAC;EACtB,MAAMiB,IAAI,GAAGF,KAAK,CAACE,IAAI;EACvB,IAAI,CAACF,KAAK,CAACG,WAAW,IAAIC,aAAa,CAACH,CAAC,EAAEC,IAAI,CAAC,EAAE;IAChD,OAAAG,iBA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F,OAAO,KAAK;EACd;EAEA,OAAO0E,UAAU;AACnB;;AAEA;AACA;AACA;;AAEA,SAASxE,aAAaA,CAACH,CAAU,EAAEC,IAAU,EAAW;EACtD,QAAQA,IAAI,CAACQ,IAAI;IACf,KAAK,WAAW;IAChB,KAAK,WAAW;IAChB,KAAK,MAAM;IACX,KAAK,WAAW;IAChB,KAAK,YAAY;IACjB,KAAK,cAAc;MACjB,OAAO,KAAK;IAEd,KAAK,OAAO;MACV,IAAIT,CAAC,CAACuC,KAAK,CAACC,EAAE,CAACvC,IAAI,CAAC,IAAID,CAAC,CAAC4C,MAAM,CAACJ,EAAE,CAACvC,IAAI,CAAC,EAAE;QACzC,OAAO,KAAK;MACd;MAEA,OAAOoC,OAAO,CAACpC,IAAI,CAACwB,IAAI,CAAC;IAC3B,KAAK,OAAO;MACV,OAAOY,OAAO,CAACpC,IAAI,CAACwB,IAAI,CAAC;IAC3B;MACE,OAAO,KAAK;EAChB;AACF","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type-expression.test.d.ts","sourceRoot":"","sources":["../../../../../src/python/components/type-expression/type-expression.test.tsx"],"names":[],"mappings":""}
|