Skip to content

Commit d2554f2

Browse files
authored
merge dev to main (v2.8.1) (#1838)
2 parents 59fe945 + 1bd1b8f commit d2554f2

File tree

24 files changed

+294
-43
lines changed

24 files changed

+294
-43
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "zenstack-monorepo",
3-
"version": "2.8.0",
3+
"version": "2.8.1",
44
"description": "",
55
"scripts": {
66
"build": "pnpm -r build",

packages/ide/jetbrains/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ plugins {
99
}
1010

1111
group = "dev.zenstack"
12-
version = "2.8.0"
12+
version = "2.8.1"
1313

1414
repositories {
1515
mavenCentral()

packages/ide/jetbrains/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "jetbrains",
3-
"version": "2.8.0",
3+
"version": "2.8.1",
44
"displayName": "ZenStack JetBrains IDE Plugin",
55
"description": "ZenStack JetBrains IDE plugin",
66
"homepage": "https://zenstack.dev",

packages/language/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@zenstackhq/language",
3-
"version": "2.8.0",
3+
"version": "2.8.1",
44
"displayName": "ZenStack modeling language compiler",
55
"description": "ZenStack modeling language compiler",
66
"homepage": "https://zenstack.dev",

packages/language/src/generated/ast.ts

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,14 @@ export function isTypeDeclaration(item: unknown): item is TypeDeclaration {
9898
return reflection.isInstance(item, TypeDeclaration);
9999
}
100100

101+
export type TypeDefFieldTypes = Enum | TypeDef;
102+
103+
export const TypeDefFieldTypes = 'TypeDefFieldTypes';
104+
105+
export function isTypeDefFieldTypes(item: unknown): item is TypeDefFieldTypes {
106+
return reflection.isInstance(item, TypeDefFieldTypes);
107+
}
108+
101109
export interface Argument extends AstNode {
102110
readonly $container: InvocationExpr;
103111
readonly $type: 'Argument';
@@ -654,7 +662,7 @@ export interface TypeDefFieldType extends AstNode {
654662
readonly $type: 'TypeDefFieldType';
655663
array: boolean
656664
optional: boolean
657-
reference?: Reference<TypeDef>
665+
reference?: Reference<TypeDefFieldTypes>
658666
type?: BuiltinType
659667
}
660668

@@ -738,14 +746,15 @@ export type ZModelAstType = {
738746
TypeDef: TypeDef
739747
TypeDefField: TypeDefField
740748
TypeDefFieldType: TypeDefFieldType
749+
TypeDefFieldTypes: TypeDefFieldTypes
741750
UnaryExpr: UnaryExpr
742751
UnsupportedFieldType: UnsupportedFieldType
743752
}
744753

745754
export class ZModelAstReflection extends AbstractAstReflection {
746755

747756
getAllTypes(): string[] {
748-
return ['AbstractDeclaration', 'Argument', 'ArrayExpr', 'Attribute', 'AttributeArg', 'AttributeParam', 'AttributeParamType', 'BinaryExpr', 'BooleanLiteral', 'ConfigArrayExpr', 'ConfigExpr', 'ConfigField', 'ConfigInvocationArg', 'ConfigInvocationExpr', 'DataModel', 'DataModelAttribute', 'DataModelField', 'DataModelFieldAttribute', 'DataModelFieldType', 'DataSource', 'Enum', 'EnumField', 'Expression', 'FieldInitializer', 'FunctionDecl', 'FunctionParam', 'FunctionParamType', 'GeneratorDecl', 'InternalAttribute', 'InvocationExpr', 'LiteralExpr', 'MemberAccessExpr', 'Model', 'ModelImport', 'NullExpr', 'NumberLiteral', 'ObjectExpr', 'Plugin', 'PluginField', 'ReferenceArg', 'ReferenceExpr', 'ReferenceTarget', 'StringLiteral', 'ThisExpr', 'TypeDeclaration', 'TypeDef', 'TypeDefField', 'TypeDefFieldType', 'UnaryExpr', 'UnsupportedFieldType'];
757+
return ['AbstractDeclaration', 'Argument', 'ArrayExpr', 'Attribute', 'AttributeArg', 'AttributeParam', 'AttributeParamType', 'BinaryExpr', 'BooleanLiteral', 'ConfigArrayExpr', 'ConfigExpr', 'ConfigField', 'ConfigInvocationArg', 'ConfigInvocationExpr', 'DataModel', 'DataModelAttribute', 'DataModelField', 'DataModelFieldAttribute', 'DataModelFieldType', 'DataSource', 'Enum', 'EnumField', 'Expression', 'FieldInitializer', 'FunctionDecl', 'FunctionParam', 'FunctionParamType', 'GeneratorDecl', 'InternalAttribute', 'InvocationExpr', 'LiteralExpr', 'MemberAccessExpr', 'Model', 'ModelImport', 'NullExpr', 'NumberLiteral', 'ObjectExpr', 'Plugin', 'PluginField', 'ReferenceArg', 'ReferenceExpr', 'ReferenceTarget', 'StringLiteral', 'ThisExpr', 'TypeDeclaration', 'TypeDef', 'TypeDefField', 'TypeDefFieldType', 'TypeDefFieldTypes', 'UnaryExpr', 'UnsupportedFieldType'];
749758
}
750759

751760
protected override computeIsSubtype(subtype: string, supertype: string): boolean {
@@ -775,16 +784,18 @@ export class ZModelAstReflection extends AbstractAstReflection {
775784
case ConfigArrayExpr: {
776785
return this.isSubtype(ConfigExpr, supertype);
777786
}
778-
case DataModel:
779-
case Enum:
780-
case TypeDef: {
787+
case DataModel: {
781788
return this.isSubtype(AbstractDeclaration, supertype) || this.isSubtype(TypeDeclaration, supertype);
782789
}
783790
case DataModelField:
784791
case EnumField:
785792
case FunctionParam: {
786793
return this.isSubtype(ReferenceTarget, supertype);
787794
}
795+
case Enum:
796+
case TypeDef: {
797+
return this.isSubtype(AbstractDeclaration, supertype) || this.isSubtype(TypeDeclaration, supertype) || this.isSubtype(TypeDefFieldTypes, supertype);
798+
}
788799
case InvocationExpr:
789800
case LiteralExpr: {
790801
return this.isSubtype(ConfigExpr, supertype) || this.isSubtype(Expression, supertype);
@@ -821,7 +832,7 @@ export class ZModelAstReflection extends AbstractAstReflection {
821832
return ReferenceTarget;
822833
}
823834
case 'TypeDefFieldType:reference': {
824-
return TypeDef;
835+
return TypeDefFieldTypes;
825836
}
826837
default: {
827838
throw new Error(`${referenceId} is not a valid reference id.`);

packages/language/src/generated/grammar.ts

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2165,7 +2165,7 @@ export const ZModelGrammar = (): Grammar => loadedZModelGrammar ?? (loadedZModel
21652165
"terminal": {
21662166
"$type": "CrossReference",
21672167
"type": {
2168-
"$ref": "#/types@1"
2168+
"$ref": "#/types@2"
21692169
},
21702170
"terminal": {
21712171
"$type": "RuleCall",
@@ -2267,7 +2267,7 @@ export const ZModelGrammar = (): Grammar => loadedZModelGrammar ?? (loadedZModel
22672267
},
22682268
"arguments": []
22692269
},
2270-
"cardinality": "+"
2270+
"cardinality": "*"
22712271
},
22722272
{
22732273
"$type": "Keyword",
@@ -2375,7 +2375,7 @@ export const ZModelGrammar = (): Grammar => loadedZModelGrammar ?? (loadedZModel
23752375
"terminal": {
23762376
"$type": "CrossReference",
23772377
"type": {
2378-
"$ref": "#/rules@40"
2378+
"$ref": "#/types@1"
23792379
},
23802380
"terminal": {
23812381
"$type": "RuleCall",
@@ -2827,7 +2827,7 @@ export const ZModelGrammar = (): Grammar => loadedZModelGrammar ?? (loadedZModel
28272827
"terminal": {
28282828
"$type": "CrossReference",
28292829
"type": {
2830-
"$ref": "#/types@1"
2830+
"$ref": "#/types@2"
28312831
},
28322832
"terminal": {
28332833
"$type": "RuleCall",
@@ -3255,7 +3255,7 @@ export const ZModelGrammar = (): Grammar => loadedZModelGrammar ?? (loadedZModel
32553255
"terminal": {
32563256
"$type": "CrossReference",
32573257
"type": {
3258-
"$ref": "#/types@1"
3258+
"$ref": "#/types@2"
32593259
},
32603260
"terminal": {
32613261
"$type": "RuleCall",
@@ -3838,6 +3838,27 @@ export const ZModelGrammar = (): Grammar => loadedZModelGrammar ?? (loadedZModel
38383838
]
38393839
}
38403840
},
3841+
{
3842+
"$type": "Type",
3843+
"name": "TypeDefFieldTypes",
3844+
"type": {
3845+
"$type": "UnionType",
3846+
"types": [
3847+
{
3848+
"$type": "SimpleType",
3849+
"typeRef": {
3850+
"$ref": "#/rules@40"
3851+
}
3852+
},
3853+
{
3854+
"$type": "SimpleType",
3855+
"typeRef": {
3856+
"$ref": "#/rules@44"
3857+
}
3858+
}
3859+
]
3860+
}
3861+
},
38413862
{
38423863
"$type": "Type",
38433864
"name": "TypeDeclaration",

packages/language/src/zmodel.langium

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -183,15 +183,17 @@ TypeDef:
183183
(comments+=TRIPLE_SLASH_COMMENT)*
184184
'type' name=RegularID '{' (
185185
fields+=TypeDefField
186-
)+
186+
)*
187187
'}';
188188

189+
type TypeDefFieldTypes = TypeDef | Enum;
190+
189191
TypeDefField:
190-
(comments+=TRIPLE_SLASH_COMMENT)*
192+
(comments+=TRIPLE_SLASH_COMMENT)*
191193
name=RegularIDWithTypeNames type=TypeDefFieldType (attributes+=DataModelFieldAttribute)*;
192194

193195
TypeDefFieldType:
194-
(type=BuiltinType | reference=[TypeDef:RegularID]) (array?='[' ']')? (optional?='?')?;
196+
(type=BuiltinType | reference=[TypeDefFieldTypes:RegularID]) (array?='[' ']')? (optional?='?')?;
195197

196198
UnsupportedFieldType:
197199
'Unsupported' '(' (value=LiteralExpr) ')';

packages/misc/redwood/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@zenstackhq/redwood",
33
"displayName": "ZenStack RedwoodJS Integration",
4-
"version": "2.8.0",
4+
"version": "2.8.1",
55
"description": "CLI and runtime for integrating ZenStack with RedwoodJS projects.",
66
"repository": {
77
"type": "git",

packages/plugins/openapi/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@zenstackhq/openapi",
33
"displayName": "ZenStack Plugin and Runtime for OpenAPI",
4-
"version": "2.8.0",
4+
"version": "2.8.1",
55
"description": "ZenStack plugin and runtime supporting OpenAPI",
66
"main": "index.js",
77
"repository": {

packages/plugins/swr/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@zenstackhq/swr",
33
"displayName": "ZenStack plugin for generating SWR hooks",
4-
"version": "2.8.0",
4+
"version": "2.8.1",
55
"description": "ZenStack plugin for generating SWR hooks",
66
"main": "index.js",
77
"repository": {

0 commit comments

Comments
 (0)