@powerlines/plugin-alloy 0.26.133 → 0.26.143
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/core/components/output.cjs +0 -1
- package/dist/core/components/single-line-comment.cjs +0 -1
- package/dist/core/components/spacing.cjs +0 -1
- package/dist/core/contexts/context.cjs +0 -1
- package/dist/core/contexts/index.cjs +0 -4
- package/dist/core/contexts/index.d.cts +2 -2
- package/dist/core/contexts/index.d.mts +2 -2
- package/dist/core/contexts/index.mjs +2 -2
- package/dist/core/contexts/meta.cjs +0 -1
- package/dist/core/contexts/schema.cjs +0 -31
- package/dist/core/contexts/schema.d.cts +6 -27
- package/dist/core/contexts/schema.d.cts.map +1 -1
- package/dist/core/contexts/schema.d.mts +6 -27
- package/dist/core/contexts/schema.d.mts.map +1 -1
- package/dist/core/contexts/schema.mjs +1 -27
- package/dist/core/contexts/schema.mjs.map +1 -1
- package/dist/core/helpers/code.cjs +0 -1
- package/dist/core/index.cjs +0 -4
- package/dist/core/index.d.cts +2 -2
- package/dist/core/index.d.mts +2 -2
- package/dist/core/index.mjs +2 -2
- package/dist/hcl/components/block-declaration.cjs +0 -1
- package/dist/hcl/components/hcl-file.cjs +0 -1
- package/dist/hcl/components/packer-file.cjs +0 -1
- package/dist/hcl/components/terraform-file.cjs +0 -1
- package/dist/helpers/create-builtin.cjs +0 -1
- package/dist/helpers/refkey.cjs +0 -1
- package/dist/helpers/typescript.cjs +0 -1
- package/dist/markdown/components/front-matter.cjs +0 -1
- package/dist/markdown/components/heading.cjs +0 -1
- package/dist/markdown/components/markdown-file.cjs +0 -1
- package/dist/markdown/components/markdown-table.cjs +0 -1
- package/dist/markdown/contexts/markdown-table.cjs +0 -1
- package/dist/render.cjs +0 -1
- package/dist/typescript/components/builtin-file.cjs +0 -1
- package/dist/typescript/components/class-declaration.cjs +0 -1
- package/dist/typescript/components/dynamic-import-statement.cjs +0 -1
- package/dist/typescript/components/interface-declaration.cjs +22 -17
- package/dist/typescript/components/interface-declaration.d.cts +15 -18
- package/dist/typescript/components/interface-declaration.d.cts.map +1 -1
- package/dist/typescript/components/interface-declaration.d.mts +15 -18
- package/dist/typescript/components/interface-declaration.d.mts.map +1 -1
- package/dist/typescript/components/interface-declaration.mjs +23 -17
- package/dist/typescript/components/interface-declaration.mjs.map +1 -1
- package/dist/typescript/components/object-declaration.cjs +6 -7
- package/dist/typescript/components/object-declaration.d.cts +7 -7
- package/dist/typescript/components/object-declaration.d.cts.map +1 -1
- package/dist/typescript/components/object-declaration.d.mts +7 -7
- package/dist/typescript/components/object-declaration.d.mts.map +1 -1
- package/dist/typescript/components/object-declaration.mjs +7 -7
- package/dist/typescript/components/object-declaration.mjs.map +1 -1
- package/dist/typescript/components/property-name.cjs +0 -1
- package/dist/typescript/components/record-expression.cjs +0 -1
- package/dist/typescript/components/tsdoc-schema.cjs +43 -50
- package/dist/typescript/components/tsdoc-schema.d.cts +7 -7
- package/dist/typescript/components/tsdoc-schema.d.cts.map +1 -1
- package/dist/typescript/components/tsdoc-schema.d.mts +7 -7
- package/dist/typescript/components/tsdoc-schema.d.mts.map +1 -1
- package/dist/typescript/components/tsdoc-schema.mjs +43 -49
- package/dist/typescript/components/tsdoc-schema.mjs.map +1 -1
- package/dist/typescript/components/tsdoc.cjs +21 -22
- package/dist/typescript/components/tsdoc.d.cts +11 -11
- package/dist/typescript/components/tsdoc.d.cts.map +1 -1
- package/dist/typescript/components/tsdoc.d.mts +11 -11
- package/dist/typescript/components/tsdoc.d.mts.map +1 -1
- package/dist/typescript/components/tsdoc.mjs +21 -21
- package/dist/typescript/components/tsdoc.mjs.map +1 -1
- package/dist/typescript/components/type-declaration.cjs +0 -1
- package/dist/typescript/components/type-parameters.cjs +0 -1
- package/dist/typescript/components/typescript-file.cjs +0 -1
- package/dist/typescript/contexts/lexical-scope.cjs +0 -1
- package/dist/typescript/contexts/member-scope.cjs +0 -1
- package/dist/typescript/helpers/get-call-signature-props.cjs +0 -1
- package/dist/yaml/components/yaml-file.cjs +0 -1
- package/package.json +8 -8
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { ComponentProps } from "../../types/components.cjs";
|
|
2
2
|
import { Children, Namekey, Refkey } from "@alloy-js/core";
|
|
3
3
|
import { CommonDeclarationProps, TypeParameterDescriptor } from "@alloy-js/typescript";
|
|
4
|
-
import {
|
|
4
|
+
import { JsonSchema, JsonSchemaPrimitiveType, JsonSchemaProperty } from "@powerlines/schema";
|
|
5
5
|
import { PartialKeys } from "@stryke/types/base";
|
|
6
6
|
|
|
7
7
|
//#region src/typescript/components/interface-declaration.d.ts
|
|
8
|
-
interface InterfaceDeclarationProps extends PartialKeys<CommonDeclarationProps, "name">, ComponentProps {
|
|
8
|
+
interface InterfaceDeclarationProps<T extends Record<string, any> = Record<string, any>> extends PartialKeys<CommonDeclarationProps, "name">, ComponentProps {
|
|
9
9
|
/**
|
|
10
10
|
* A base type that this interface extends. This can be used to represent inheritance
|
|
11
11
|
*/
|
|
@@ -15,19 +15,19 @@ interface InterfaceDeclarationProps extends PartialKeys<CommonDeclarationProps,
|
|
|
15
15
|
*/
|
|
16
16
|
typeParameters?: TypeParameterDescriptor[] | string[];
|
|
17
17
|
/**
|
|
18
|
-
* The
|
|
18
|
+
* The JSON Schema that describes the properties of this interface.
|
|
19
19
|
*
|
|
20
20
|
* @remarks
|
|
21
21
|
* This is used to generate the members of the interface based on the properties of the schema.
|
|
22
22
|
*/
|
|
23
|
-
schema?:
|
|
23
|
+
schema?: JsonSchema<T>;
|
|
24
24
|
/**
|
|
25
25
|
* Documentation for the interface. This can be a string or any Alloy component that renders documentation content (such as `TSDoc`).
|
|
26
26
|
*/
|
|
27
27
|
doc?: Children;
|
|
28
28
|
}
|
|
29
|
-
interface InterfaceDeclarationPropertyProps extends Omit<InterfaceMemberProps
|
|
30
|
-
schema:
|
|
29
|
+
interface InterfaceDeclarationPropertyProps<T extends Record<string, any> = Record<string, any>> extends Omit<InterfaceMemberProps<T>, "name">, ComponentProps {
|
|
30
|
+
schema: JsonSchemaProperty<T>;
|
|
31
31
|
}
|
|
32
32
|
interface InterfaceExpressionProps {
|
|
33
33
|
children?: Children;
|
|
@@ -37,23 +37,20 @@ interface InterfaceMemberPropsBase {
|
|
|
37
37
|
children?: Children;
|
|
38
38
|
doc?: Children;
|
|
39
39
|
refkey?: Refkey | Refkey[];
|
|
40
|
+
readOnly?: boolean;
|
|
41
|
+
type?: Children | JsonSchemaPrimitiveType;
|
|
42
|
+
nullish?: boolean;
|
|
40
43
|
}
|
|
41
44
|
interface InterfacePropertyMemberProps extends InterfaceMemberPropsBase {
|
|
42
45
|
name: string | Namekey;
|
|
43
|
-
isReadonly?: boolean;
|
|
44
|
-
type?: Children | JTDType;
|
|
45
|
-
optional?: boolean;
|
|
46
|
-
nullish?: boolean;
|
|
47
46
|
}
|
|
48
47
|
interface InterfaceIndexerMemberProps extends InterfaceMemberPropsBase {
|
|
49
48
|
indexer: Children;
|
|
50
|
-
isReadonly?: boolean;
|
|
51
|
-
type?: Children | JTDType;
|
|
52
49
|
}
|
|
53
|
-
interface InterfaceSchemaMemberProps extends InterfaceMemberPropsBase {
|
|
54
|
-
schema:
|
|
50
|
+
interface InterfaceSchemaMemberProps<T extends Record<string, any> = Record<string, any>> extends InterfaceMemberPropsBase {
|
|
51
|
+
schema: JsonSchemaProperty<T>;
|
|
55
52
|
}
|
|
56
|
-
type InterfaceMemberProps = InterfacePropertyMemberProps | InterfaceIndexerMemberProps | InterfaceSchemaMemberProps
|
|
53
|
+
type InterfaceMemberProps<T extends Record<string, any> = Record<string, any>> = InterfacePropertyMemberProps | InterfaceIndexerMemberProps | InterfaceSchemaMemberProps<T>;
|
|
57
54
|
/**
|
|
58
55
|
* Create a TypeScript interface member.
|
|
59
56
|
*
|
|
@@ -63,15 +60,15 @@ type InterfaceMemberProps = InterfacePropertyMemberProps | InterfaceIndexerMembe
|
|
|
63
60
|
* The type of the member can be provided either as the `type` prop or as the
|
|
64
61
|
* children of the component.
|
|
65
62
|
*/
|
|
66
|
-
declare function InterfaceMember(props: InterfaceMemberProps): Children;
|
|
63
|
+
declare function InterfaceMember<T extends Record<string, any> = Record<string, any>>(props: InterfaceMemberProps<T>): Children;
|
|
67
64
|
/**
|
|
68
65
|
* Generates a TypeScript interface for the given schema.
|
|
69
66
|
*/
|
|
70
|
-
declare function InterfaceDeclaration(props: InterfaceDeclarationProps): Children;
|
|
67
|
+
declare function InterfaceDeclaration<T extends Record<string, any> = Record<string, any>>(props: InterfaceDeclarationProps<T>): Children;
|
|
71
68
|
/**
|
|
72
69
|
* Generates a TypeScript interface property for the given reflection class.
|
|
73
70
|
*/
|
|
74
|
-
declare function InterfaceDeclarationProperty(props: InterfaceDeclarationPropertyProps): Children;
|
|
71
|
+
declare function InterfaceDeclarationProperty<T extends Record<string, any> = Record<string, any>>(props: InterfaceDeclarationPropertyProps<T>): Children;
|
|
75
72
|
//#endregion
|
|
76
73
|
export { InterfaceDeclaration, InterfaceDeclarationProperty, InterfaceDeclarationPropertyProps, InterfaceDeclarationProps, InterfaceExpression, InterfaceExpressionProps, InterfaceIndexerMemberProps, InterfaceMember, InterfaceMemberProps, InterfaceMemberPropsBase, InterfacePropertyMemberProps, InterfaceSchemaMemberProps };
|
|
77
74
|
//# sourceMappingURL=interface-declaration.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interface-declaration.d.cts","names":[],"sources":["../../../src/typescript/components/interface-declaration.tsx"],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"interface-declaration.d.cts","names":[],"sources":["../../../src/typescript/components/interface-declaration.tsx"],"mappings":";;;;;;;UA0EiB,yBAAA,WACL,MAAA,gBAAsB,MAAA,uBAExB,WAAA,CAAY,sBAAA,WAAiC,cAAA;;AAHvD;;EAOE,OAAA,GAAU,QAAA;EANA;;;EAWV,cAAA,GAAiB,uBAAA;EAAA;;;;;;EAQjB,MAAA,GAAS,UAAA,CAAW,CAAA;EAjB+C;;;EAsBnE,GAAA,GAAM,QAAA;AAAA;AAAA,UAGS,iCAAA,WACL,MAAA,gBAAsB,MAAA,uBAExB,IAAA,CAAK,oBAAA,CAAqB,CAAA,YAAa,cAAA;EAC/C,MAAA,EAAQ,kBAAA,CAAmB,CAAA;AAAA;AAAA,UAGZ,wBAAA;EACf,QAAA,GAAW,QAAQ;AAAA;AAAA,cAGR,mBAAA,2BAAmB,SAAA,CAAA,wBAAA;AAAA,UAoBf,wBAAA;EACf,QAAA,GAAW,QAAA;EACX,GAAA,GAAM,QAAA;EACN,MAAA,GAAS,MAAA,GAAS,MAAA;EAClB,QAAA;EACA,IAAA,GAAO,QAAA,GAAW,uBAAA;EAClB,OAAA;AAAA;AAAA,UAGe,4BAAA,SAAqC,wBAAwB;EAC5E,IAAA,WAAe,OAAA;AAAA;AAAA,UAGA,2BAAA,SAAoC,wBAAwB;EAC3E,OAAA,EAAS,QAAA;AAAA;AAAA,UAGM,0BAAA,WACL,MAAA,gBAAsB,MAAA,uBACxB,wBAAA;EACR,MAAA,EAAQ,kBAAA,CAAmB,CAAA;AAAA;AAAA,KAGjB,oBAAA,WACA,MAAA,gBAAsB,MAAA,iBAE9B,4BAAA,GACA,2BAAA,GACA,0BAAA,CAA2B,CAAA;;;;;;;;;;iBAWf,eAAA,WACJ,MAAA,gBAAsB,MAAA,cAAA,CAChC,KAAA,EAAO,oBAAA,CAAqB,CAAA,IAAE,QAAA;;;AApEF;iBAyMd,oBAAA,WACJ,MAAA,gBAAsB,MAAA,cAAA,CAChC,KAAA,EAAO,yBAAA,CAA0B,CAAA,IAAE,QAAA;;;;iBA8DrB,4BAAA,WACJ,MAAA,gBAAsB,MAAA,cAAA,CAChC,KAAA,EAAO,iCAAA,CAAkC,CAAA,IAAE,QAAA"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { ComponentProps } from "../../types/components.mjs";
|
|
2
2
|
import { Children, Namekey, Refkey } from "@alloy-js/core";
|
|
3
3
|
import { CommonDeclarationProps, TypeParameterDescriptor } from "@alloy-js/typescript";
|
|
4
|
-
import {
|
|
4
|
+
import { JsonSchema, JsonSchemaPrimitiveType, JsonSchemaProperty } from "@powerlines/schema";
|
|
5
5
|
import { PartialKeys } from "@stryke/types/base";
|
|
6
6
|
|
|
7
7
|
//#region src/typescript/components/interface-declaration.d.ts
|
|
8
|
-
interface InterfaceDeclarationProps extends PartialKeys<CommonDeclarationProps, "name">, ComponentProps {
|
|
8
|
+
interface InterfaceDeclarationProps<T extends Record<string, any> = Record<string, any>> extends PartialKeys<CommonDeclarationProps, "name">, ComponentProps {
|
|
9
9
|
/**
|
|
10
10
|
* A base type that this interface extends. This can be used to represent inheritance
|
|
11
11
|
*/
|
|
@@ -15,19 +15,19 @@ interface InterfaceDeclarationProps extends PartialKeys<CommonDeclarationProps,
|
|
|
15
15
|
*/
|
|
16
16
|
typeParameters?: TypeParameterDescriptor[] | string[];
|
|
17
17
|
/**
|
|
18
|
-
* The
|
|
18
|
+
* The JSON Schema that describes the properties of this interface.
|
|
19
19
|
*
|
|
20
20
|
* @remarks
|
|
21
21
|
* This is used to generate the members of the interface based on the properties of the schema.
|
|
22
22
|
*/
|
|
23
|
-
schema?:
|
|
23
|
+
schema?: JsonSchema<T>;
|
|
24
24
|
/**
|
|
25
25
|
* Documentation for the interface. This can be a string or any Alloy component that renders documentation content (such as `TSDoc`).
|
|
26
26
|
*/
|
|
27
27
|
doc?: Children;
|
|
28
28
|
}
|
|
29
|
-
interface InterfaceDeclarationPropertyProps extends Omit<InterfaceMemberProps
|
|
30
|
-
schema:
|
|
29
|
+
interface InterfaceDeclarationPropertyProps<T extends Record<string, any> = Record<string, any>> extends Omit<InterfaceMemberProps<T>, "name">, ComponentProps {
|
|
30
|
+
schema: JsonSchemaProperty<T>;
|
|
31
31
|
}
|
|
32
32
|
interface InterfaceExpressionProps {
|
|
33
33
|
children?: Children;
|
|
@@ -37,23 +37,20 @@ interface InterfaceMemberPropsBase {
|
|
|
37
37
|
children?: Children;
|
|
38
38
|
doc?: Children;
|
|
39
39
|
refkey?: Refkey | Refkey[];
|
|
40
|
+
readOnly?: boolean;
|
|
41
|
+
type?: Children | JsonSchemaPrimitiveType;
|
|
42
|
+
nullish?: boolean;
|
|
40
43
|
}
|
|
41
44
|
interface InterfacePropertyMemberProps extends InterfaceMemberPropsBase {
|
|
42
45
|
name: string | Namekey;
|
|
43
|
-
isReadonly?: boolean;
|
|
44
|
-
type?: Children | JTDType;
|
|
45
|
-
optional?: boolean;
|
|
46
|
-
nullish?: boolean;
|
|
47
46
|
}
|
|
48
47
|
interface InterfaceIndexerMemberProps extends InterfaceMemberPropsBase {
|
|
49
48
|
indexer: Children;
|
|
50
|
-
isReadonly?: boolean;
|
|
51
|
-
type?: Children | JTDType;
|
|
52
49
|
}
|
|
53
|
-
interface InterfaceSchemaMemberProps extends InterfaceMemberPropsBase {
|
|
54
|
-
schema:
|
|
50
|
+
interface InterfaceSchemaMemberProps<T extends Record<string, any> = Record<string, any>> extends InterfaceMemberPropsBase {
|
|
51
|
+
schema: JsonSchemaProperty<T>;
|
|
55
52
|
}
|
|
56
|
-
type InterfaceMemberProps = InterfacePropertyMemberProps | InterfaceIndexerMemberProps | InterfaceSchemaMemberProps
|
|
53
|
+
type InterfaceMemberProps<T extends Record<string, any> = Record<string, any>> = InterfacePropertyMemberProps | InterfaceIndexerMemberProps | InterfaceSchemaMemberProps<T>;
|
|
57
54
|
/**
|
|
58
55
|
* Create a TypeScript interface member.
|
|
59
56
|
*
|
|
@@ -63,15 +60,15 @@ type InterfaceMemberProps = InterfacePropertyMemberProps | InterfaceIndexerMembe
|
|
|
63
60
|
* The type of the member can be provided either as the `type` prop or as the
|
|
64
61
|
* children of the component.
|
|
65
62
|
*/
|
|
66
|
-
declare function InterfaceMember(props: InterfaceMemberProps): Children;
|
|
63
|
+
declare function InterfaceMember<T extends Record<string, any> = Record<string, any>>(props: InterfaceMemberProps<T>): Children;
|
|
67
64
|
/**
|
|
68
65
|
* Generates a TypeScript interface for the given schema.
|
|
69
66
|
*/
|
|
70
|
-
declare function InterfaceDeclaration(props: InterfaceDeclarationProps): Children;
|
|
67
|
+
declare function InterfaceDeclaration<T extends Record<string, any> = Record<string, any>>(props: InterfaceDeclarationProps<T>): Children;
|
|
71
68
|
/**
|
|
72
69
|
* Generates a TypeScript interface property for the given reflection class.
|
|
73
70
|
*/
|
|
74
|
-
declare function InterfaceDeclarationProperty(props: InterfaceDeclarationPropertyProps): Children;
|
|
71
|
+
declare function InterfaceDeclarationProperty<T extends Record<string, any> = Record<string, any>>(props: InterfaceDeclarationPropertyProps<T>): Children;
|
|
75
72
|
//#endregion
|
|
76
73
|
export { InterfaceDeclaration, InterfaceDeclarationProperty, InterfaceDeclarationPropertyProps, InterfaceDeclarationProps, InterfaceExpression, InterfaceExpressionProps, InterfaceIndexerMemberProps, InterfaceMember, InterfaceMemberProps, InterfaceMemberPropsBase, InterfacePropertyMemberProps, InterfaceSchemaMemberProps };
|
|
77
74
|
//# sourceMappingURL=interface-declaration.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interface-declaration.d.mts","names":[],"sources":["../../../src/typescript/components/interface-declaration.tsx"],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"interface-declaration.d.mts","names":[],"sources":["../../../src/typescript/components/interface-declaration.tsx"],"mappings":";;;;;;;UA0EiB,yBAAA,WACL,MAAA,gBAAsB,MAAA,uBAExB,WAAA,CAAY,sBAAA,WAAiC,cAAA;;AAHvD;;EAOE,OAAA,GAAU,QAAA;EANA;;;EAWV,cAAA,GAAiB,uBAAA;EAAA;;;;;;EAQjB,MAAA,GAAS,UAAA,CAAW,CAAA;EAjB+C;;;EAsBnE,GAAA,GAAM,QAAA;AAAA;AAAA,UAGS,iCAAA,WACL,MAAA,gBAAsB,MAAA,uBAExB,IAAA,CAAK,oBAAA,CAAqB,CAAA,YAAa,cAAA;EAC/C,MAAA,EAAQ,kBAAA,CAAmB,CAAA;AAAA;AAAA,UAGZ,wBAAA;EACf,QAAA,GAAW,QAAQ;AAAA;AAAA,cAGR,mBAAA,2BAAmB,SAAA,CAAA,wBAAA;AAAA,UAoBf,wBAAA;EACf,QAAA,GAAW,QAAA;EACX,GAAA,GAAM,QAAA;EACN,MAAA,GAAS,MAAA,GAAS,MAAA;EAClB,QAAA;EACA,IAAA,GAAO,QAAA,GAAW,uBAAA;EAClB,OAAA;AAAA;AAAA,UAGe,4BAAA,SAAqC,wBAAwB;EAC5E,IAAA,WAAe,OAAA;AAAA;AAAA,UAGA,2BAAA,SAAoC,wBAAwB;EAC3E,OAAA,EAAS,QAAA;AAAA;AAAA,UAGM,0BAAA,WACL,MAAA,gBAAsB,MAAA,uBACxB,wBAAA;EACR,MAAA,EAAQ,kBAAA,CAAmB,CAAA;AAAA;AAAA,KAGjB,oBAAA,WACA,MAAA,gBAAsB,MAAA,iBAE9B,4BAAA,GACA,2BAAA,GACA,0BAAA,CAA2B,CAAA;;;;;;;;;;iBAWf,eAAA,WACJ,MAAA,gBAAsB,MAAA,cAAA,CAChC,KAAA,EAAO,oBAAA,CAAqB,CAAA,IAAE,QAAA;;;AApEF;iBAyMd,oBAAA,WACJ,MAAA,gBAAsB,MAAA,cAAA,CAChC,KAAA,EAAO,yBAAA,CAA0B,CAAA,IAAE,QAAA;;;;iBA8DrB,4BAAA,WACJ,MAAA,gBAAsB,MAAA,cAAA,CAChC,KAAA,EAAO,iCAAA,CAAkC,CAAA,IAAE,QAAA"}
|
|
@@ -10,7 +10,7 @@ import { camelCase } from "@stryke/string-format/camel-case";
|
|
|
10
10
|
import { pascalCase } from "@stryke/string-format/pascal-case";
|
|
11
11
|
import { Declaration as Declaration$1, TSOutputSymbol, TSSymbolFlags, ensureTypeRefContext, useTSLexicalScope, useTSMemberScope, useTSNamePolicy } from "@alloy-js/typescript";
|
|
12
12
|
import { isSetString } from "@stryke/type-checks/is-set-string";
|
|
13
|
-
import {
|
|
13
|
+
import { getPrimarySchemaType, getPropertiesList, isSchemaNullable, stringifyType } from "@powerlines/schema";
|
|
14
14
|
import { uuid } from "@stryke/unique-id/uuid";
|
|
15
15
|
|
|
16
16
|
//#region src/typescript/components/interface-declaration.tsx
|
|
@@ -42,7 +42,7 @@ const InterfaceExpression = ensureTypeRefContext(function InterfaceExpression(pr
|
|
|
42
42
|
*/
|
|
43
43
|
function InterfaceMember(props) {
|
|
44
44
|
const type = props.schema ? stringifyType(props.schema) : props.type ?? props.children;
|
|
45
|
-
const readonly = props.schema && props.schema?.
|
|
45
|
+
const readonly = props.schema && props.schema?.readOnly || !props.schema && props.readOnly ? "readonly " : "";
|
|
46
46
|
if ("indexer" in props) return [
|
|
47
47
|
createComponent(Show, {
|
|
48
48
|
get when() {
|
|
@@ -60,9 +60,9 @@ function InterfaceMember(props) {
|
|
|
60
60
|
"]: ",
|
|
61
61
|
type
|
|
62
62
|
];
|
|
63
|
-
const optional = !!(props.schema && props.schema
|
|
63
|
+
const optional = !!(props.schema && "nullable" in props.schema && props.schema.nullable) || !!props.nullish;
|
|
64
64
|
const scope = useTSMemberScope();
|
|
65
|
-
const sym = createSymbol(TSOutputSymbol,
|
|
65
|
+
const sym = createSymbol(TSOutputSymbol, ((props.schema ? props.schema?.name : void 0) || isSetString(props.name) ? props.name : props.name.toString()) || uuid().replace(/-/g, ""), scope.ownerSymbol.staticMembers, {
|
|
66
66
|
refkeys: props.refkey,
|
|
67
67
|
tsFlags: TSSymbolFlags.TypeSymbol | (optional ? TSSymbolFlags.Nullish : TSSymbolFlags.None),
|
|
68
68
|
namePolicy: useTSNamePolicy().for("interface-member"),
|
|
@@ -157,16 +157,25 @@ function InterfaceDeclaration(props) {
|
|
|
157
157
|
"schema",
|
|
158
158
|
"doc"
|
|
159
159
|
]);
|
|
160
|
-
const interfaceName = computed(() => pascalCase(isSetString(name) ? name : schema?.
|
|
161
|
-
const properties = computed(() => schema ?
|
|
160
|
+
const interfaceName = computed(() => pascalCase(isSetString(name) ? name : schema?.name || schema?.title || ""));
|
|
161
|
+
const properties = computed(() => schema ? getPropertiesList(schema).filter((property) => !property?.ignore).sort((a, b) => a?.readOnly && b?.readOnly || !a?.readOnly && !b?.readOnly ? !a.name && !b.name ? 0 : !a.name ? -1 : !b.name ? 1 : a.name.localeCompare(b.name) : a?.readOnly ? 1 : -1) : []);
|
|
162
162
|
return createComponent(Show, {
|
|
163
163
|
get when() {
|
|
164
164
|
return schema && properties.value.length > 0;
|
|
165
165
|
},
|
|
166
166
|
get fallback() {
|
|
167
|
-
return createComponent(BaseInterfaceDeclaration, mergeProps(props, {
|
|
168
|
-
|
|
169
|
-
|
|
167
|
+
return createComponent(BaseInterfaceDeclaration, mergeProps(props, {
|
|
168
|
+
get schema() {
|
|
169
|
+
return {
|
|
170
|
+
type: "object",
|
|
171
|
+
name: interfaceName.value,
|
|
172
|
+
properties: {}
|
|
173
|
+
};
|
|
174
|
+
},
|
|
175
|
+
get name() {
|
|
176
|
+
return interfaceName.value;
|
|
177
|
+
}
|
|
178
|
+
}));
|
|
170
179
|
},
|
|
171
180
|
get children() {
|
|
172
181
|
return createComponent(SchemaContext.Provider, {
|
|
@@ -198,7 +207,7 @@ function InterfaceDeclaration(props) {
|
|
|
198
207
|
*/
|
|
199
208
|
function InterfaceDeclarationProperty(props) {
|
|
200
209
|
const [{ schema }, rest] = splitProps(props, ["schema"]);
|
|
201
|
-
const name = computed(() => schema
|
|
210
|
+
const name = computed(() => schema?.name || camelCase(schema?.title || schema?.databaseSchemaName || schema?.$id));
|
|
202
211
|
return createComponent(Show, {
|
|
203
212
|
get when() {
|
|
204
213
|
return isSetString(name.value);
|
|
@@ -211,17 +220,14 @@ function InterfaceDeclarationProperty(props) {
|
|
|
211
220
|
get name() {
|
|
212
221
|
return name.value;
|
|
213
222
|
},
|
|
214
|
-
get
|
|
215
|
-
return schema
|
|
216
|
-
},
|
|
217
|
-
get optional() {
|
|
218
|
-
return !!schema.metadata?.isOptional;
|
|
223
|
+
get readOnly() {
|
|
224
|
+
return schema?.readOnly;
|
|
219
225
|
},
|
|
220
226
|
get nullish() {
|
|
221
|
-
return
|
|
227
|
+
return schema?.nullable || isSchemaNullable(schema);
|
|
222
228
|
},
|
|
223
229
|
get type() {
|
|
224
|
-
return schema
|
|
230
|
+
return getPrimarySchemaType(schema);
|
|
225
231
|
}
|
|
226
232
|
}, rest))];
|
|
227
233
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interface-declaration.mjs","names":[],"sources":["../../../src/typescript/components/interface-declaration.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport {\n Block,\n Children,\n childrenArray,\n computed,\n createSymbol,\n createSymbolSlot,\n effect,\n emitSymbol,\n findUnkeyedChildren,\n For,\n MemberDeclaration,\n Name,\n Namekey,\n Refkey,\n Show,\n splitProps,\n takeSymbols\n} from \"@alloy-js/core\";\nimport {\n CommonDeclarationProps,\n Declaration,\n ensureTypeRefContext,\n TSOutputSymbol,\n TSSymbolFlags,\n TypeParameterDescriptor,\n useTSLexicalScope,\n useTSMemberScope,\n useTSNamePolicy\n} from \"@alloy-js/typescript\";\nimport {\n getProperties,\n JTDSchemaObjectType,\n JTDSchemaType,\n JTDType,\n stringifyType\n} from \"@powerlines/schema\";\nimport { camelCase } from \"@stryke/string-format/camel-case\";\nimport { pascalCase } from \"@stryke/string-format/pascal-case\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { PartialKeys } from \"@stryke/types/base\";\nimport { uuid } from \"@stryke/unique-id/uuid\";\nimport {\n SchemaContext,\n SchemaPropertyContext\n} from \"../../core/contexts/schema\";\nimport { ComponentProps } from \"../../types/components\";\nimport { MemberScope } from \"../contexts/member-scope\";\nimport { PropertyName } from \"./property-name\";\nimport { TSDoc } from \"./tsdoc\";\nimport { TSDocObjectSchema, TSDocSchemaProperty } from \"./tsdoc-schema\";\nimport { TypeParameters } from \"./type-parameters\";\n\nexport interface InterfaceDeclarationProps\n extends PartialKeys<CommonDeclarationProps, \"name\">, ComponentProps {\n /**\n * A base type that this interface extends. This can be used to represent inheritance\n */\n extends?: Children;\n\n /**\n * The generic type parameters of the interface.\n */\n typeParameters?: TypeParameterDescriptor[] | string[];\n\n /**\n * The JTD Schema that describes the properties of this interface.\n *\n * @remarks\n * This is used to generate the members of the interface based on the properties of the schema.\n */\n schema?: JTDSchemaObjectType;\n\n /**\n * Documentation for the interface. This can be a string or any Alloy component that renders documentation content (such as `TSDoc`).\n */\n doc?: Children;\n}\n\nexport interface InterfaceDeclarationPropertyProps\n extends Omit<InterfaceMemberProps, \"name\">, ComponentProps {\n schema: JTDSchemaType;\n}\n\nexport interface InterfaceExpressionProps {\n children?: Children;\n}\n\nexport const InterfaceExpression = ensureTypeRefContext(\n function InterfaceExpression(props: InterfaceExpressionProps) {\n const scope = useTSLexicalScope();\n const symbol = createSymbol(TSOutputSymbol, \"\", undefined, {\n transient: true,\n binder: scope?.binder\n });\n\n emitSymbol(symbol);\n\n return (\n <group>\n <MemberScope ownerSymbol={symbol}>\n <Block>{props.children}</Block>\n </MemberScope>\n </group>\n );\n }\n);\n\nexport interface InterfaceMemberPropsBase {\n children?: Children;\n doc?: Children;\n refkey?: Refkey | Refkey[];\n}\nexport interface InterfacePropertyMemberProps extends InterfaceMemberPropsBase {\n name: string | Namekey;\n isReadonly?: boolean;\n type?: Children | JTDType;\n optional?: boolean;\n nullish?: boolean;\n}\n\nexport interface InterfaceIndexerMemberProps extends InterfaceMemberPropsBase {\n indexer: Children;\n isReadonly?: boolean;\n type?: Children | JTDType;\n}\n\nexport interface InterfaceSchemaMemberProps extends InterfaceMemberPropsBase {\n schema: JTDSchemaType;\n}\n\nexport type InterfaceMemberProps =\n | InterfacePropertyMemberProps\n | InterfaceIndexerMemberProps\n | InterfaceSchemaMemberProps;\n\n/**\n * Create a TypeScript interface member.\n *\n * An interface member can either provide a `name` prop to create a named\n * property, or an `indexer` prop to define an indexer for the interface.\n *\n * The type of the member can be provided either as the `type` prop or as the\n * children of the component.\n */\nexport function InterfaceMember(props: InterfaceMemberProps) {\n const type = (props as InterfaceSchemaMemberProps).schema\n ? stringifyType((props as InterfaceSchemaMemberProps).schema)\n : ((props as InterfacePropertyMemberProps | InterfaceIndexerMemberProps)\n .type ?? props.children);\n\n const readonly =\n ((props as InterfaceSchemaMemberProps).schema &&\n (props as InterfaceSchemaMemberProps).schema?.metadata?.isReadonly) ||\n (!(props as InterfaceSchemaMemberProps).schema &&\n (props as InterfacePropertyMemberProps | InterfaceIndexerMemberProps)\n .isReadonly)\n ? \"readonly \"\n : \"\";\n\n if (\"indexer\" in props) {\n return (\n <>\n <Show when={Boolean(props.doc)}>\n <TSDoc heading={props.doc} />\n </Show>\n {readonly}[{props.indexer}]: {type}\n </>\n );\n }\n\n const optional =\n !!(\n (props as InterfaceSchemaMemberProps).schema &&\n (props as InterfaceSchemaMemberProps).schema?.nullable\n ) ||\n !!(\n !(props as InterfaceSchemaMemberProps).schema &&\n (props as InterfacePropertyMemberProps).optional\n );\n\n const scope = useTSMemberScope();\n const sym = createSymbol(\n TSOutputSymbol,\n String(\n ((props as InterfaceSchemaMemberProps).schema\n ? (props as InterfaceSchemaMemberProps).schema.metadata?.name ||\n (props as InterfaceSchemaMemberProps).schema.metadata?.resourceId\n : isSetString((props as InterfacePropertyMemberProps).name)\n ? (props as InterfacePropertyMemberProps).name\n : (props as InterfacePropertyMemberProps).name.toString()) ||\n uuid().replace(/-/g, \"\")\n ),\n scope.ownerSymbol.staticMembers,\n {\n refkeys: props.refkey,\n tsFlags:\n TSSymbolFlags.TypeSymbol |\n (optional ? TSSymbolFlags.Nullish : TSSymbolFlags.None),\n namePolicy: useTSNamePolicy().for(\"interface-member\"),\n binder: scope.binder\n }\n );\n\n const taken = takeSymbols();\n\n effect(() => {\n if (taken.size > 1) return;\n const symbol = Array.from(taken)[0];\n if (symbol?.isTransient) {\n symbol.moveMembersTo(sym);\n }\n });\n\n return (\n <MemberDeclaration symbol={sym}>\n <Show when={Boolean(props.doc)}>\n <TSDoc heading={props.doc} />\n </Show>\n {readonly}\n <PropertyName />\n {optional ? \"?\" : \"\"}: {type}\n </MemberDeclaration>\n );\n}\n\nconst BaseInterfaceDeclaration = ensureTypeRefContext(\n function InterfaceDeclaration(props: InterfaceDeclarationProps) {\n const ExprSlot = createSymbolSlot();\n\n const children = childrenArray(() => props.children);\n\n const extendsPart = props.extends ? <> extends {props.extends}</> : \"\";\n const filteredChildren = findUnkeyedChildren(children);\n const currentScope = useTSLexicalScope();\n\n const binder = currentScope?.binder;\n const sym = createSymbol(\n TSOutputSymbol,\n (isSetString(props.name) ? props.name : props.name?.toString()) ||\n uuid().replace(/-/g, \"\"),\n currentScope.types,\n {\n refkeys: props.refkey,\n default: props.default,\n export: props.export,\n metadata: props.metadata,\n tsFlags: TSSymbolFlags.TypeSymbol,\n namePolicy: useTSNamePolicy().for(\"interface\"),\n binder\n }\n );\n\n effect(() => {\n if (ExprSlot.ref.value) {\n const takenSymbols = ExprSlot.ref.value;\n for (const symbol of takenSymbols) {\n // ignore non-transient symbols (likely not the result of an expression).\n if (symbol.isTransient) {\n symbol.moveMembersTo(sym);\n }\n }\n }\n });\n\n return (\n <>\n <Show when={Boolean(props.doc)}>\n <TSDoc heading={props.doc} />\n </Show>\n <Declaration {...props} nameKind=\"interface\" kind=\"type\" symbol={sym}>\n interface <Name />\n {props.typeParameters && (\n <TypeParameters parameters={props.typeParameters} />\n )}\n {extendsPart}{\" \"}\n <ExprSlot>\n <InterfaceExpression>{filteredChildren}</InterfaceExpression>\n </ExprSlot>\n </Declaration>\n </>\n );\n }\n);\n\n/**\n * Generates a TypeScript interface for the given schema.\n */\nexport function InterfaceDeclaration(props: InterfaceDeclarationProps) {\n const [{ name, schema, doc }, rest] = splitProps(props, [\n \"name\",\n \"schema\",\n \"doc\"\n ]);\n\n const interfaceName = computed(() =>\n pascalCase(\n isSetString(name)\n ? name\n : schema?.metadata?.name || schema?.metadata?.title || \"\"\n )\n );\n const properties = computed(() =>\n schema\n ? Object.values(getProperties(schema))\n .filter(property => !property.metadata?.isIgnored)\n .sort((a, b) =>\n (a.metadata?.isReadonly && b.metadata?.isReadonly) ||\n (!a.metadata?.isReadonly && !b.metadata?.isReadonly)\n ? a.name.localeCompare(b.name)\n : a.metadata?.isReadonly\n ? 1\n : -1\n )\n : []\n );\n\n return (\n <Show\n when={schema && properties.value.length > 0}\n fallback={\n <BaseInterfaceDeclaration {...props} name={interfaceName.value} />\n }>\n <SchemaContext.Provider value={schema}>\n <TSDocObjectSchema heading={doc} schema={schema!} />\n <BaseInterfaceDeclaration\n export={true}\n name={interfaceName.value}\n {...rest}>\n <For each={properties} doubleHardline={true} semicolon={true}>\n {property => <InterfaceDeclarationProperty schema={property} />}\n </For>\n </BaseInterfaceDeclaration>\n </SchemaContext.Provider>\n </Show>\n );\n}\n\n/**\n * Generates a TypeScript interface property for the given reflection class.\n */\nexport function InterfaceDeclarationProperty(\n props: InterfaceDeclarationPropertyProps\n) {\n const [{ schema }, rest] = splitProps(props, [\"schema\"]);\n\n const name = computed(\n () =>\n schema.metadata?.name ||\n camelCase(schema.metadata?.title || schema.metadata?.resourceId)\n );\n\n return (\n <Show when={isSetString(name.value)}>\n <SchemaPropertyContext.Provider value={schema}>\n <TSDocSchemaProperty schema={schema} />\n <InterfaceMember\n name={name.value!}\n isReadonly={schema.metadata?.isReadonly}\n optional={!!schema.metadata?.isOptional}\n nullish={!!schema?.nullable}\n type={(schema as { type?: JTDType }).type}\n {...rest}\n />\n </SchemaPropertyContext.Provider>\n </Show>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;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AAA;MAClC,UAAS;MACT,IAAK,OAAI;OACV,OAAW,cAAW;MACpB;KACF,GAAG,MAAM,EACP,IAAG,WAAY;MACtB,OAAA,gBAAA,KAAA;OACK,MAAY;OAClB,gBAAA;OACW,WAAY;OACd,WAAA,aAAA,gBAAA,8BAAA,EACL,QAAc,SACb,CAAQ;MACX,CAAA;KACM,EACR,CAAA,CAAA,CAAA;IACD;;EAED;;AAEF;;;;AAKA,SAAI,6BAAA,OAAA;CACF,MAAE,CAAA,YAEF,QAAO,WAAA,OAAA,CAAA,QAAA,CAAA;CACP,MAAG,OAAA,eAAyB,OAAK,UAAA,QAAA,UAAA,OAAA,UAAA,SAAA,OAAA,UAAA,UAAA,CAAA;CACjC,OAAK,gBAAmB,MAAM;EAC5B,IAAI,OAAO;GACT,OAAM,YAAA,KAAA,KAAA;EACR;EACA,IAAG,WAAY;GACb,OAAC,gBAAuB,sBAAI,UAAA;IAC5B,OAAA;IACH,IAAA,WAAA;KACH,OAAA,CAAA,gBAAA,qBAAA,SAEM,CAAA,GAAA,gBAA0B,iBAAC,WAAoB;MAC1C,IAAA,OAAA;OACD,OAAW,KAAA;;MAEX,IAAA,aAAW;;MAEX;MACA,IAAA,WAAiB;OACjB,OAAA,CAAY,CAAC,OAAE,UAAA;;MAEf,IAAM,UAAG;OACL,OAAE,CAAA,CAAA,QAAY;MACtB;MACC,IAAA,OAAY;OACL,OAAC,OAAa;MACtB;KACA,GAAA,IAAA,CAAA,CAAA;IACE;GACF,CAAC;EACH;CACF,CAAC;AACH"}
|
|
1
|
+
{"version":3,"file":"interface-declaration.mjs","names":[],"sources":["../../../src/typescript/components/interface-declaration.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport {\n Block,\n Children,\n childrenArray,\n computed,\n createSymbol,\n createSymbolSlot,\n effect,\n emitSymbol,\n findUnkeyedChildren,\n For,\n MemberDeclaration,\n Name,\n Namekey,\n Refkey,\n Show,\n splitProps,\n takeSymbols\n} from \"@alloy-js/core\";\nimport {\n CommonDeclarationProps,\n Declaration,\n ensureTypeRefContext,\n TSOutputSymbol,\n TSSymbolFlags,\n TypeParameterDescriptor,\n useTSLexicalScope,\n useTSMemberScope,\n useTSNamePolicy\n} from \"@alloy-js/typescript\";\nimport {\n getPrimarySchemaType,\n getPropertiesList,\n isSchemaNullable,\n JsonSchema,\n JsonSchemaLike,\n JsonSchemaPrimitiveType,\n JsonSchemaProperty,\n stringifyType\n} from \"@powerlines/schema\";\nimport { camelCase } from \"@stryke/string-format/camel-case\";\nimport { pascalCase } from \"@stryke/string-format/pascal-case\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { PartialKeys } from \"@stryke/types/base\";\nimport { uuid } from \"@stryke/unique-id/uuid\";\nimport {\n SchemaContext,\n SchemaPropertyContext\n} from \"../../core/contexts/schema\";\nimport { ComponentProps } from \"../../types/components\";\nimport { MemberScope } from \"../contexts/member-scope\";\nimport { PropertyName } from \"./property-name\";\nimport { TSDoc } from \"./tsdoc\";\nimport { TSDocObjectSchema, TSDocSchemaProperty } from \"./tsdoc-schema\";\nimport { TypeParameters } from \"./type-parameters\";\n\nexport interface InterfaceDeclarationProps<\n T extends Record<string, any> = Record<string, any>\n>\n extends PartialKeys<CommonDeclarationProps, \"name\">, ComponentProps {\n /**\n * A base type that this interface extends. This can be used to represent inheritance\n */\n extends?: Children;\n\n /**\n * The generic type parameters of the interface.\n */\n typeParameters?: TypeParameterDescriptor[] | string[];\n\n /**\n * The JSON Schema that describes the properties of this interface.\n *\n * @remarks\n * This is used to generate the members of the interface based on the properties of the schema.\n */\n schema?: JsonSchema<T>;\n\n /**\n * Documentation for the interface. This can be a string or any Alloy component that renders documentation content (such as `TSDoc`).\n */\n doc?: Children;\n}\n\nexport interface InterfaceDeclarationPropertyProps<\n T extends Record<string, any> = Record<string, any>\n>\n extends Omit<InterfaceMemberProps<T>, \"name\">, ComponentProps {\n schema: JsonSchemaProperty<T>;\n}\n\nexport interface InterfaceExpressionProps {\n children?: Children;\n}\n\nexport const InterfaceExpression = ensureTypeRefContext(\n function InterfaceExpression(props: InterfaceExpressionProps) {\n const scope = useTSLexicalScope();\n const symbol = createSymbol(TSOutputSymbol, \"\", undefined, {\n transient: true,\n binder: scope?.binder\n });\n\n emitSymbol(symbol);\n\n return (\n <group>\n <MemberScope ownerSymbol={symbol}>\n <Block>{props.children}</Block>\n </MemberScope>\n </group>\n );\n }\n);\n\nexport interface InterfaceMemberPropsBase {\n children?: Children;\n doc?: Children;\n refkey?: Refkey | Refkey[];\n readOnly?: boolean;\n type?: Children | JsonSchemaPrimitiveType;\n nullish?: boolean;\n}\n\nexport interface InterfacePropertyMemberProps extends InterfaceMemberPropsBase {\n name: string | Namekey;\n}\n\nexport interface InterfaceIndexerMemberProps extends InterfaceMemberPropsBase {\n indexer: Children;\n}\n\nexport interface InterfaceSchemaMemberProps<\n T extends Record<string, any> = Record<string, any>\n> extends InterfaceMemberPropsBase {\n schema: JsonSchemaProperty<T>;\n}\n\nexport type InterfaceMemberProps<\n T extends Record<string, any> = Record<string, any>\n> =\n | InterfacePropertyMemberProps\n | InterfaceIndexerMemberProps\n | InterfaceSchemaMemberProps<T>;\n\n/**\n * Create a TypeScript interface member.\n *\n * An interface member can either provide a `name` prop to create a named\n * property, or an `indexer` prop to define an indexer for the interface.\n *\n * The type of the member can be provided either as the `type` prop or as the\n * children of the component.\n */\nexport function InterfaceMember<\n T extends Record<string, any> = Record<string, any>\n>(props: InterfaceMemberProps<T>) {\n const type = (props as InterfaceSchemaMemberProps<T>).schema\n ? stringifyType<T>((props as InterfaceSchemaMemberProps<T>).schema)\n : (props.type ?? props.children);\n\n const readonly =\n ((props as InterfaceSchemaMemberProps<T>).schema &&\n (props as InterfaceSchemaMemberProps<T>).schema?.readOnly) ||\n (!(props as InterfaceSchemaMemberProps<T>).schema && props.readOnly)\n ? \"readonly \"\n : \"\";\n\n if (\"indexer\" in props) {\n return (\n <>\n <Show when={Boolean(props.doc)}>\n <TSDoc heading={props.doc} />\n </Show>\n {readonly}[{props.indexer}]: {type}\n </>\n );\n }\n\n const optional =\n !!(\n (props as InterfaceSchemaMemberProps<T>).schema &&\n \"nullable\" in (props as InterfaceSchemaMemberProps<T>).schema &&\n (props as InterfaceSchemaMemberProps<T>).schema.nullable\n ) || !!props.nullish;\n\n const scope = useTSMemberScope();\n const sym = createSymbol(\n TSOutputSymbol,\n (((props as InterfaceSchemaMemberProps<T>).schema\n ? (props as InterfaceSchemaMemberProps<T>).schema?.name\n : undefined) || isSetString((props as InterfacePropertyMemberProps).name)\n ? (props as InterfacePropertyMemberProps).name\n : (props as InterfacePropertyMemberProps).name.toString()) ||\n uuid().replace(/-/g, \"\"),\n scope.ownerSymbol.staticMembers,\n {\n refkeys: props.refkey,\n tsFlags:\n TSSymbolFlags.TypeSymbol |\n (optional ? TSSymbolFlags.Nullish : TSSymbolFlags.None),\n namePolicy: useTSNamePolicy().for(\"interface-member\"),\n binder: scope.binder\n }\n );\n\n const taken = takeSymbols();\n effect(() => {\n if (taken.size > 1) return;\n const symbol = Array.from(taken)[0];\n if (symbol?.isTransient) {\n symbol.moveMembersTo(sym);\n }\n });\n\n return (\n <MemberDeclaration symbol={sym}>\n <Show when={Boolean(props.doc)}>\n <TSDoc heading={props.doc} />\n </Show>\n {readonly}\n <PropertyName />\n {optional ? \"?\" : \"\"}: {type}\n </MemberDeclaration>\n );\n}\n\nconst BaseInterfaceDeclaration = ensureTypeRefContext(\n function InterfaceDeclaration(props: InterfaceDeclarationProps) {\n const ExprSlot = createSymbolSlot();\n\n const children = childrenArray(() => props.children);\n\n const extendsPart = props.extends ? <> extends {props.extends}</> : \"\";\n const filteredChildren = findUnkeyedChildren(children);\n const currentScope = useTSLexicalScope();\n\n const binder = currentScope?.binder;\n const sym = createSymbol(\n TSOutputSymbol,\n (isSetString(props.name) ? props.name : props.name?.toString()) ||\n uuid().replace(/-/g, \"\"),\n currentScope.types,\n {\n refkeys: props.refkey,\n default: props.default,\n export: props.export,\n metadata: props.metadata,\n tsFlags: TSSymbolFlags.TypeSymbol,\n namePolicy: useTSNamePolicy().for(\"interface\"),\n binder\n }\n );\n\n effect(() => {\n if (ExprSlot.ref.value) {\n const takenSymbols = ExprSlot.ref.value;\n for (const symbol of takenSymbols) {\n // ignore non-transient symbols (likely not the result of an expression).\n if (symbol.isTransient) {\n symbol.moveMembersTo(sym);\n }\n }\n }\n });\n\n return (\n <>\n <Show when={Boolean(props.doc)}>\n <TSDoc heading={props.doc} />\n </Show>\n <Declaration {...props} nameKind=\"interface\" kind=\"type\" symbol={sym}>\n interface <Name />\n {props.typeParameters && (\n <TypeParameters parameters={props.typeParameters} />\n )}\n {extendsPart}{\" \"}\n <ExprSlot>\n <InterfaceExpression>{filteredChildren}</InterfaceExpression>\n </ExprSlot>\n </Declaration>\n </>\n );\n }\n);\n\n/**\n * Generates a TypeScript interface for the given schema.\n */\nexport function InterfaceDeclaration<\n T extends Record<string, any> = Record<string, any>\n>(props: InterfaceDeclarationProps<T>) {\n const [{ name, schema, doc }, rest] = splitProps(props, [\n \"name\",\n \"schema\",\n \"doc\"\n ]);\n\n const interfaceName = computed(() =>\n pascalCase(isSetString(name) ? name : schema?.name || schema?.title || \"\")\n );\n const properties = computed(() =>\n schema\n ? getPropertiesList<T>(schema as Parameters<typeof getPropertiesList>[0])\n .filter(property => !property?.ignore)\n .sort((a, b) =>\n (a?.readOnly && b?.readOnly) || (!a?.readOnly && !b?.readOnly)\n ? !a.name && !b.name\n ? 0\n : !a.name\n ? -1\n : !b.name\n ? 1\n : a.name.localeCompare(b.name)\n : a?.readOnly\n ? 1\n : -1\n )\n : []\n );\n\n return (\n <Show\n when={schema && properties.value.length > 0}\n fallback={\n <BaseInterfaceDeclaration\n {...props}\n schema={{\n type: \"object\",\n name: interfaceName.value,\n properties: {}\n }}\n name={interfaceName.value}\n />\n }>\n <SchemaContext.Provider value={schema as JsonSchemaLike}>\n <TSDocObjectSchema heading={doc} schema={schema!} />\n <BaseInterfaceDeclaration\n export={true}\n name={interfaceName.value}\n {...rest}>\n <For each={properties} doubleHardline={true} semicolon={true}>\n {property => <InterfaceDeclarationProperty schema={property} />}\n </For>\n </BaseInterfaceDeclaration>\n </SchemaContext.Provider>\n </Show>\n );\n}\n\n/**\n * Generates a TypeScript interface property for the given reflection class.\n */\nexport function InterfaceDeclarationProperty<\n T extends Record<string, any> = Record<string, any>\n>(props: InterfaceDeclarationPropertyProps<T>) {\n const [{ schema }, rest] = splitProps(props, [\"schema\"]);\n\n const name = computed(\n () =>\n schema?.name ||\n camelCase(schema?.title || schema?.databaseSchemaName || schema?.$id)\n );\n\n return (\n <Show when={isSetString(name.value)}>\n <SchemaPropertyContext.Provider value={schema as JsonSchemaLike}>\n <TSDocSchemaProperty schema={schema} />\n <InterfaceMember\n name={name.value}\n readOnly={schema?.readOnly}\n nullish={schema?.nullable || isSchemaNullable<T>(schema)}\n type={getPrimarySchemaType<T>(schema)}\n {...rest}\n />\n </SchemaPropertyContext.Provider>\n </Show>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAkCA,MAAY,sBAAA,qBAAA,SAAA,oBAAA,OAAA;CAEV,MAAM,SAAS,aAAM,gBAAA,IAAA,QAAA;EACvB,WAAO;EACL,QAHA,kBAGA,GAAA;CACA,CAAA;CACA,WAAA,MAAA;CACA,OAAA,gBAAc,SAAA,EACd,IAAA,WAAa;EACb,OAAA,gBAAuB,eAAA;GACvB,aAAiB;GACjB,IAAA,WAAgB;IAChB,OAAA,gBAAA,OAAA,EACO,IAAM,WAAG;KACX,OA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AAI,QAAA,UAAA,QAAA,SAAA,QAAA,sBAAA,QAAA,GAAA,CAAA;CAChC,OAAI,gBAAiB,MAAA;EACpB,IAAA,OAAA;GACH,OAAA,YAAA,KAAA,KAAA;;EAEA,IAAM,WAAA;GACJ,OAAS,gBAAoB,sBAAQ,UAAA;IACnC,OAAM;;KAEA,OAAA,CAAQ,gBAAkB,qBAAoB,SAE9C,CAAA,GAAA,gBAAoB,iBAAa,WAAe;MAChD,IAAA,OAAA;OACA,OAAA,KAAe;;MAEf,IAAM,WAAG;OACL,OAAE,QAAY;MACtB;MACC,IAAA,UAAkB;OACX,OAAC,QAAc,YAAG,iBAAA,MAAA;MAC1B;MACA,IAAA,OAAA;OACE,OAAS,qBAAY,MAAA;MACrB;KACA,GAAA,IAAQ,CAAA,CAAA;IACR;GACF,CAAC;EACH;CACF,CAAC;AACH"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
|
|
3
2
|
const require_core_contexts_schema = require('../../core/contexts/schema.cjs');
|
|
4
3
|
const require_typescript_components_tsdoc_schema = require('./tsdoc-schema.cjs');
|
|
5
4
|
let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
@@ -17,12 +16,12 @@ let _powerlines_schema = require("@powerlines/schema");
|
|
|
17
16
|
function ObjectDeclaration(props) {
|
|
18
17
|
const { schema } = props;
|
|
19
18
|
if (!schema) return null;
|
|
20
|
-
const name = (0, _alloy_js_core.computed)(() => (0, _stryke_string_format_camel_case.camelCase)((0, _stryke_type_checks_is_set_string.isSetString)(props.name) ? props.name : schema
|
|
21
|
-
const defaultValues = (0, _alloy_js_core.computed)(() => schema
|
|
22
|
-
const properties = (0, _alloy_js_core.computed)(() =>
|
|
19
|
+
const name = (0, _alloy_js_core.computed)(() => (0, _stryke_string_format_camel_case.camelCase)((0, _stryke_type_checks_is_set_string.isSetString)(props.name) ? props.name : schema?.name));
|
|
20
|
+
const defaultValues = (0, _alloy_js_core.computed)(() => schema?.default || {});
|
|
21
|
+
const properties = (0, _alloy_js_core.computed)(() => (0, _powerlines_schema.getPropertiesList)(schema).filter((property) => !property?.ignore && !property?.runtime && !(0, _stryke_type_checks_is_undefined.isUndefined)(defaultValues.value[property.name] ?? property?.alias?.reduce((ret, alias) => {
|
|
23
22
|
if ((0, _stryke_type_checks_is_undefined.isUndefined)(ret) && !(0, _stryke_type_checks_is_undefined.isUndefined)(defaultValues.value[alias])) return defaultValues.value[alias];
|
|
24
23
|
return ret;
|
|
25
|
-
}, void 0) ?? property
|
|
24
|
+
}, void 0) ?? property?.default)).sort((a, b) => a?.readOnly && b?.readOnly || !a?.readOnly && !b?.readOnly ? a.name.localeCompare(b.name) : a?.readOnly ? 1 : -1));
|
|
26
25
|
const TypeSymbolSlot = (0, _alloy_js_core.createSymbolSlot)();
|
|
27
26
|
const ValueTypeSymbolSlot = (0, _alloy_js_core.createSymbolSlot)();
|
|
28
27
|
const sym = (0, _alloy_js_typescript.createValueSymbol)(name.value || "schema", {
|
|
@@ -91,7 +90,7 @@ function ObjectDeclaration(props) {
|
|
|
91
90
|
*/
|
|
92
91
|
function ObjectDeclarationProperty(props) {
|
|
93
92
|
const [{ schema }, rest] = (0, _alloy_js_core.splitProps)(props, ["schema"]);
|
|
94
|
-
const name = (0, _alloy_js_core.computed)(() => schema
|
|
93
|
+
const name = (0, _alloy_js_core.computed)(() => schema?.name || (0, _stryke_string_format_camel_case.camelCase)(schema?.title || schema?.databaseSchemaName || schema?.$id));
|
|
95
94
|
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
96
95
|
get when() {
|
|
97
96
|
return (0, _stryke_type_checks_is_set_string.isSetString)(name.value);
|
|
@@ -107,7 +106,7 @@ function ObjectDeclarationProperty(props) {
|
|
|
107
106
|
return name.value;
|
|
108
107
|
},
|
|
109
108
|
get value() {
|
|
110
|
-
return (0, _alloy_js_core_jsx_runtime.memo)(() => !!!(0, _stryke_type_checks_is_undefined.isUndefined)(schema
|
|
109
|
+
return (0, _alloy_js_core_jsx_runtime.memo)(() => !!!(0, _stryke_type_checks_is_undefined.isUndefined)(schema?.default))() ? JSON.stringify(schema?.default) : void 0;
|
|
111
110
|
}
|
|
112
111
|
}, rest)),
|
|
113
112
|
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import { ComponentProps } from "../../types/components.cjs";
|
|
2
2
|
import { VarDeclarationProps } from "@alloy-js/typescript";
|
|
3
|
-
import {
|
|
3
|
+
import { JsonSchema, JsonSchemaProperty } from "@powerlines/schema";
|
|
4
4
|
|
|
5
5
|
//#region src/typescript/components/object-declaration.d.ts
|
|
6
|
-
interface ObjectDeclarationProps extends VarDeclarationProps {
|
|
7
|
-
schema?:
|
|
6
|
+
interface ObjectDeclarationProps<T extends Record<string, any> = Record<string, any>> extends VarDeclarationProps {
|
|
7
|
+
schema?: JsonSchema<T>;
|
|
8
8
|
}
|
|
9
9
|
/**
|
|
10
10
|
* Generates a TypeScript object for the given reflection class.
|
|
11
11
|
*/
|
|
12
|
-
declare function ObjectDeclaration(props: ObjectDeclarationProps): import("@alloy-js/core").Children;
|
|
13
|
-
interface ObjectDeclarationPropertyProps extends ComponentProps {
|
|
14
|
-
schema:
|
|
12
|
+
declare function ObjectDeclaration<T extends Record<string, any> = Record<string, any>>(props: ObjectDeclarationProps<T>): import("@alloy-js/core").Children;
|
|
13
|
+
interface ObjectDeclarationPropertyProps<T extends Record<string, any> = Record<string, any>> extends ComponentProps {
|
|
14
|
+
schema: JsonSchemaProperty<T>;
|
|
15
15
|
}
|
|
16
16
|
/**
|
|
17
17
|
* Generates a TypeScript object property for the given reflection class.
|
|
18
18
|
*/
|
|
19
|
-
declare function ObjectDeclarationProperty(props: ObjectDeclarationPropertyProps): import("@alloy-js/core").Children;
|
|
19
|
+
declare function ObjectDeclarationProperty<T extends Record<string, any> = Record<string, any>>(props: ObjectDeclarationPropertyProps<T>): import("@alloy-js/core").Children;
|
|
20
20
|
//#endregion
|
|
21
21
|
export { ObjectDeclaration, ObjectDeclarationProperty, ObjectDeclarationPropertyProps, ObjectDeclarationProps };
|
|
22
22
|
//# sourceMappingURL=object-declaration.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"object-declaration.d.cts","names":[],"sources":["../../../src/typescript/components/object-declaration.tsx"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"object-declaration.d.cts","names":[],"sources":["../../../src/typescript/components/object-declaration.tsx"],"mappings":";;;;;UAoDiB,sBAAA,WACL,MAAA,gBAAsB,MAAA,uBACxB,mBAAA;EACR,MAAA,GAAS,UAAA,CAAW,CAAA;AAAA;;;;iBAMN,iBAAA,WACJ,MAAA,gBAAsB,MAAA,cAAA,CAChC,KAAA,EAAO,sBAAA,CAAuB,CAAA,6BAAE,QAAA;AAAA,UAkGjB,8BAAA,WACL,MAAA,gBAAsB,MAAA,uBACxB,cAAA;EACR,MAAA,EAAQ,kBAAA,CAAmB,CAAA;AAAA;;;;iBAMb,yBAAA,WACJ,MAAA,gBAAsB,MAAA,cAAA,CAChC,KAAA,EAAO,8BAAA,CAA+B,CAAA,6BAAE,QAAA"}
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import { ComponentProps } from "../../types/components.mjs";
|
|
2
2
|
import { VarDeclarationProps } from "@alloy-js/typescript";
|
|
3
|
-
import {
|
|
3
|
+
import { JsonSchema, JsonSchemaProperty } from "@powerlines/schema";
|
|
4
4
|
|
|
5
5
|
//#region src/typescript/components/object-declaration.d.ts
|
|
6
|
-
interface ObjectDeclarationProps extends VarDeclarationProps {
|
|
7
|
-
schema?:
|
|
6
|
+
interface ObjectDeclarationProps<T extends Record<string, any> = Record<string, any>> extends VarDeclarationProps {
|
|
7
|
+
schema?: JsonSchema<T>;
|
|
8
8
|
}
|
|
9
9
|
/**
|
|
10
10
|
* Generates a TypeScript object for the given reflection class.
|
|
11
11
|
*/
|
|
12
|
-
declare function ObjectDeclaration(props: ObjectDeclarationProps): import("@alloy-js/core").Children;
|
|
13
|
-
interface ObjectDeclarationPropertyProps extends ComponentProps {
|
|
14
|
-
schema:
|
|
12
|
+
declare function ObjectDeclaration<T extends Record<string, any> = Record<string, any>>(props: ObjectDeclarationProps<T>): import("@alloy-js/core").Children;
|
|
13
|
+
interface ObjectDeclarationPropertyProps<T extends Record<string, any> = Record<string, any>> extends ComponentProps {
|
|
14
|
+
schema: JsonSchemaProperty<T>;
|
|
15
15
|
}
|
|
16
16
|
/**
|
|
17
17
|
* Generates a TypeScript object property for the given reflection class.
|
|
18
18
|
*/
|
|
19
|
-
declare function ObjectDeclarationProperty(props: ObjectDeclarationPropertyProps): import("@alloy-js/core").Children;
|
|
19
|
+
declare function ObjectDeclarationProperty<T extends Record<string, any> = Record<string, any>>(props: ObjectDeclarationPropertyProps<T>): import("@alloy-js/core").Children;
|
|
20
20
|
//#endregion
|
|
21
21
|
export { ObjectDeclaration, ObjectDeclarationProperty, ObjectDeclarationPropertyProps, ObjectDeclarationProps };
|
|
22
22
|
//# sourceMappingURL=object-declaration.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"object-declaration.d.mts","names":[],"sources":["../../../src/typescript/components/object-declaration.tsx"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"object-declaration.d.mts","names":[],"sources":["../../../src/typescript/components/object-declaration.tsx"],"mappings":";;;;;UAoDiB,sBAAA,WACL,MAAA,gBAAsB,MAAA,uBACxB,mBAAA;EACR,MAAA,GAAS,UAAA,CAAW,CAAA;AAAA;;;;iBAMN,iBAAA,WACJ,MAAA,gBAAsB,MAAA,cAAA,CAChC,KAAA,EAAO,sBAAA,CAAuB,CAAA,6BAAE,QAAA;AAAA,UAkGjB,8BAAA,WACL,MAAA,gBAAsB,MAAA,uBACxB,cAAA;EACR,MAAA,EAAQ,kBAAA,CAAmB,CAAA;AAAA;;;;iBAMb,yBAAA,WACJ,MAAA,gBAAsB,MAAA,cAAA,CAChC,KAAA,EAAO,8BAAA,CAA+B,CAAA,6BAAE,QAAA"}
|
|
@@ -6,7 +6,7 @@ import { camelCase } from "@stryke/string-format/camel-case";
|
|
|
6
6
|
import { isUndefined } from "@stryke/type-checks/is-undefined";
|
|
7
7
|
import { ObjectExpression, ObjectProperty, TSSymbolFlags, TypeRefContext, createValueSymbol, useTSNamePolicy } from "@alloy-js/typescript";
|
|
8
8
|
import { isSetString } from "@stryke/type-checks/is-set-string";
|
|
9
|
-
import {
|
|
9
|
+
import { getPropertiesList } from "@powerlines/schema";
|
|
10
10
|
|
|
11
11
|
//#region src/typescript/components/object-declaration.tsx
|
|
12
12
|
/**
|
|
@@ -15,12 +15,12 @@ import { getProperties } from "@powerlines/schema";
|
|
|
15
15
|
function ObjectDeclaration(props) {
|
|
16
16
|
const { schema } = props;
|
|
17
17
|
if (!schema) return null;
|
|
18
|
-
const name = computed(() => camelCase(isSetString(props.name) ? props.name : schema
|
|
19
|
-
const defaultValues = computed(() => schema
|
|
20
|
-
const properties = computed(() =>
|
|
18
|
+
const name = computed(() => camelCase(isSetString(props.name) ? props.name : schema?.name));
|
|
19
|
+
const defaultValues = computed(() => schema?.default || {});
|
|
20
|
+
const properties = computed(() => getPropertiesList(schema).filter((property) => !property?.ignore && !property?.runtime && !isUndefined(defaultValues.value[property.name] ?? property?.alias?.reduce((ret, alias) => {
|
|
21
21
|
if (isUndefined(ret) && !isUndefined(defaultValues.value[alias])) return defaultValues.value[alias];
|
|
22
22
|
return ret;
|
|
23
|
-
}, void 0) ?? property
|
|
23
|
+
}, void 0) ?? property?.default)).sort((a, b) => a?.readOnly && b?.readOnly || !a?.readOnly && !b?.readOnly ? a.name.localeCompare(b.name) : a?.readOnly ? 1 : -1));
|
|
24
24
|
const TypeSymbolSlot = createSymbolSlot();
|
|
25
25
|
const ValueTypeSymbolSlot = createSymbolSlot();
|
|
26
26
|
const sym = createValueSymbol(name.value || "schema", {
|
|
@@ -89,7 +89,7 @@ function ObjectDeclaration(props) {
|
|
|
89
89
|
*/
|
|
90
90
|
function ObjectDeclarationProperty(props) {
|
|
91
91
|
const [{ schema }, rest] = splitProps(props, ["schema"]);
|
|
92
|
-
const name = computed(() => schema
|
|
92
|
+
const name = computed(() => schema?.name || camelCase(schema?.title || schema?.databaseSchemaName || schema?.$id));
|
|
93
93
|
return createComponent(Show, {
|
|
94
94
|
get when() {
|
|
95
95
|
return isSetString(name.value);
|
|
@@ -105,7 +105,7 @@ function ObjectDeclarationProperty(props) {
|
|
|
105
105
|
return name.value;
|
|
106
106
|
},
|
|
107
107
|
get value() {
|
|
108
|
-
return memo(() => !!!isUndefined(schema
|
|
108
|
+
return memo(() => !!!isUndefined(schema?.default))() ? JSON.stringify(schema?.default) : void 0;
|
|
109
109
|
}
|
|
110
110
|
}, rest)),
|
|
111
111
|
createIntrinsic("hbr", {})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"object-declaration.mjs","names":[],"sources":["../../../src/typescript/components/object-declaration.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport {\n computed,\n Declaration as CoreDeclaration,\n createSymbolSlot,\n For,\n Name,\n Show,\n splitProps\n} from \"@alloy-js/core\";\nimport {\n createValueSymbol,\n ObjectExpression,\n ObjectProperty,\n TSSymbolFlags,\n TypeRefContext,\n useTSNamePolicy,\n VarDeclarationProps\n} from \"@alloy-js/typescript\";\nimport {\n
|
|
1
|
+
{"version":3,"file":"object-declaration.mjs","names":[],"sources":["../../../src/typescript/components/object-declaration.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport {\n computed,\n Declaration as CoreDeclaration,\n createSymbolSlot,\n For,\n Name,\n Show,\n splitProps\n} from \"@alloy-js/core\";\nimport {\n createValueSymbol,\n ObjectExpression,\n ObjectProperty,\n TSSymbolFlags,\n TypeRefContext,\n useTSNamePolicy,\n VarDeclarationProps\n} from \"@alloy-js/typescript\";\nimport {\n getPropertiesList,\n JsonSchema,\n JsonSchemaLike,\n JsonSchemaProperty\n} from \"@powerlines/schema\";\nimport { camelCase } from \"@stryke/string-format/camel-case\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { isUndefined } from \"@stryke/type-checks/is-undefined\";\nimport {\n SchemaContext,\n SchemaPropertyContext\n} from \"../../core/contexts/schema\";\nimport { ComponentProps } from \"../../types/components\";\nimport { TSDocObjectSchema, TSDocSchemaProperty } from \"./tsdoc-schema\";\n\nexport interface ObjectDeclarationProps<\n T extends Record<string, any> = Record<string, any>\n> extends VarDeclarationProps {\n schema?: JsonSchema<T>;\n}\n\n/**\n * Generates a TypeScript object for the given reflection class.\n */\nexport function ObjectDeclaration<\n T extends Record<string, any> = Record<string, any>\n>(props: ObjectDeclarationProps<T>) {\n const { schema } = props;\n if (!schema) {\n return null;\n }\n\n const name = computed(() =>\n camelCase(isSetString(props.name) ? props.name : schema?.name)\n );\n\n const defaultValues = computed(\n () => (schema?.default || {}) as Record<string, unknown>\n );\n const properties = computed(() =>\n getPropertiesList<T>(schema)\n .filter(\n property =>\n !property?.ignore &&\n !property?.runtime &&\n !isUndefined(\n defaultValues.value[property.name] ??\n property?.alias?.reduce((ret, alias) => {\n if (\n isUndefined(ret) &&\n !isUndefined(defaultValues.value[alias])\n ) {\n return defaultValues.value[alias];\n }\n\n return ret;\n }, undefined as any) ??\n property?.default\n )\n )\n .sort((a, b) =>\n (a?.readOnly && b?.readOnly) || (!a?.readOnly && !b?.readOnly)\n ? a.name.localeCompare(b.name)\n : a?.readOnly\n ? 1\n : -1\n )\n );\n\n const TypeSymbolSlot = createSymbolSlot();\n const ValueTypeSymbolSlot = createSymbolSlot();\n const sym = createValueSymbol(name.value || \"schema\", {\n refkeys: props.refkey,\n default: props.default,\n export: props.export,\n metadata: props.metadata,\n tsFlags: props.nullish ? TSSymbolFlags.Nullish : TSSymbolFlags.None,\n type: props.type ? TypeSymbolSlot.firstSymbol : undefined,\n namePolicy: useTSNamePolicy().for(\"variable\")\n });\n\n if (!props.type) {\n ValueTypeSymbolSlot.moveMembersTo(sym);\n }\n\n const keyword = props.var ? \"var\" : props.let ? \"let\" : \"const\";\n const type = props.type ? (\n <TypeRefContext>\n : <TypeSymbolSlot>{props.type}</TypeSymbolSlot>\n </TypeRefContext>\n ) : undefined;\n\n return (\n <Show when={!!schema}>\n <SchemaContext.Provider value={schema as JsonSchemaLike}>\n <Show when={!!name.value && !!type}>\n <TSDocObjectSchema schema={schema} />\n <CoreDeclaration symbol={sym}>\n {props.export ? \"export \" : \"\"}\n {props.default ? \"default \" : \"\"}\n {keyword} <Name />\n {type} ={\" \"}\n <ValueTypeSymbolSlot>\n {props.initializer ?? props.children ?? (\n <ObjectExpression>\n <For\n each={properties.value ?? []}\n comma={true}\n doubleHardline={true}>\n {property => (\n <ObjectDeclarationProperty schema={property} />\n )}\n </For>\n </ObjectExpression>\n )}\n </ValueTypeSymbolSlot>\n </CoreDeclaration>\n </Show>\n <hbr />\n </SchemaContext.Provider>\n </Show>\n );\n}\n\nexport interface ObjectDeclarationPropertyProps<\n T extends Record<string, any> = Record<string, any>\n> extends ComponentProps {\n schema: JsonSchemaProperty<T>;\n}\n\n/**\n * Generates a TypeScript object property for the given reflection class.\n */\nexport function ObjectDeclarationProperty<\n T extends Record<string, any> = Record<string, any>\n>(props: ObjectDeclarationPropertyProps<T>) {\n const [{ schema }, rest] = splitProps(props, [\"schema\"]);\n\n const name = computed(\n () =>\n schema?.name ||\n camelCase(schema?.title || schema?.databaseSchemaName || schema?.$id)\n );\n\n return (\n <Show when={isSetString(name.value)}>\n <SchemaPropertyContext.Provider value={schema as JsonSchemaLike}>\n <TSDocSchemaProperty schema={schema} />\n <ObjectProperty\n name={name.value}\n value={\n !isUndefined(schema?.default)\n ? JSON.stringify(schema?.default)\n : undefined\n }\n {...rest}\n />\n <hbr />\n </SchemaPropertyContext.Provider>\n </Show>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;AA+BA,SAAe,kBAAA,OAAA;CACb,MAAA,EACA,WACA;CACA,IAAI,CAAC,QACP,OAAO;CAEL,MAAA,OAAU,eAAA,UAAA,YAAA,MAAA,IAAA,IAAA,MAAA,OAAA,QAAA,IAAA,CAAA;CACV,MAAA,gBAAc,eAAA,QAAA,WAAA,CAAA,CAAA;CACd,MAAA,aAAA,eAAA,kBAAA,MAAA,EAAA,QAAA,aAAA,CAAA,UAAA,UAAA,CAAA,UAAA,WAAA,CAAA,YAAA,cAAA,MAAA,SAAA,SAAA,UAAA,OAAA,QAAA,KAAA,UAAA;EACA,IAAM,YAAY,GAAA,KAAO,CAAA,YAAA,cAAA,MAAA,MAAA,GACrB,OAAG,cAAkB,MAAC;EAE5B,OAAS;CACT,GAAA,MAAO,KAAA,UAAA,OAAA,CAAA,EAAA,MAAA,GAAA,MAAA,GAAA,YAAA,GAAA,YAAA,CAAA,GAAA,YAAA,CAAA,GAAA,WAAA,EAAA,KAAA,cAAA,EAAA,IAAA,IAAA,GAAA,W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ACJ,WAAA,aAAA,gBAAA,2BAAA,EACc,QAAA,SACO,CAAA;YACR,CAAA;WACJ,EACD,CAAA;UACC,EACT,CAAA;SAAA;QACH;;MAEK;KACA,CAAA,GAAA,gBAAsB,OAAA,CAAA,CAAA,CAAA;IACtB;GACJ,CAAA;EACA;CACF,CAAC;AACH;;;;AAIA,SAAI,0BAAA,OAAA;UAEA,UACA,QAAA,WAAoB,OAAA,CAAA,QAAc,CAAG;CACvC,MAAA,OAAA,eAAA,QAAA,QAAA,UAAA,QAAA,SAAA,QAAA,sBAAA,QAAA,GAAA,CAAA;;EAEA,IAAM,OAAO;GACb,OAAW,YAAY,KAAG,KAAA;EACxB;EACA,IAAI,WAAC;GACH,OAAA,gBAAc,sBAAA,UAAA;IACd,OAAS;;KAEN,OAAA;MAAA,gBAAA,qBAAA,EACS,OACX,CAAA;MAAA,gBAAuB,gBAAiB,WAAc;OACpD,IAAK,OAAQ;QACX,OAAA,KAAA;OACA;OACC,IAAC,QAAM;QACN,OAAM,WAAW,CAAA,CAAA,CAAO,YAAO,QAAA,OAAA,CAAA,EAAA,IAAA,KAAA,UAAA,QAAA,OAAA,IAAA;OAChC;MACF,GAAG,IAAI,CAAC;MAAG,gBAAG,OAAA,CAAA,CAAA;KAAA;IAChB;GACF,CAAC;EACH;CACF,CAAC;AACH"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
|
|
3
2
|
const require_typescript_helpers_utilities = require('../helpers/utilities.cjs');
|
|
4
3
|
let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
5
4
|
let _alloy_js_core = require("@alloy-js/core");
|