@zenstackhq/schema 3.0.0-beta.19 → 3.0.0-beta.21
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/index.d.cts +12 -3
- package/dist/index.d.ts +12 -3
- package/package.json +3 -3
package/dist/index.d.cts
CHANGED
|
@@ -75,6 +75,7 @@ declare const ExpressionUtils: {
|
|
|
75
75
|
type DataSourceProviderType = 'sqlite' | 'postgresql';
|
|
76
76
|
type DataSourceProvider = {
|
|
77
77
|
type: DataSourceProviderType;
|
|
78
|
+
defaultSchema?: string;
|
|
78
79
|
};
|
|
79
80
|
type SchemaDef = {
|
|
80
81
|
provider: DataSourceProvider;
|
|
@@ -143,7 +144,15 @@ type ProcedureDef = {
|
|
|
143
144
|
};
|
|
144
145
|
type BuiltinType = 'String' | 'Boolean' | 'Int' | 'Float' | 'BigInt' | 'Decimal' | 'DateTime' | 'Bytes' | 'Json' | 'Unsupported';
|
|
145
146
|
type MappedBuiltinType = string | boolean | number | bigint | Decimal | Date;
|
|
146
|
-
type
|
|
147
|
+
type EnumField = {
|
|
148
|
+
name: string;
|
|
149
|
+
attributes?: AttributeApplication[];
|
|
150
|
+
};
|
|
151
|
+
type EnumDef = {
|
|
152
|
+
fields?: Record<string, EnumField>;
|
|
153
|
+
values: Record<string, string>;
|
|
154
|
+
attributes?: AttributeApplication[];
|
|
155
|
+
};
|
|
147
156
|
type TypeDefDef = {
|
|
148
157
|
name: string;
|
|
149
158
|
fields: Record<string, FieldDef>;
|
|
@@ -156,7 +165,7 @@ type GetDelegateModels<Schema extends SchemaDef> = keyof {
|
|
|
156
165
|
type GetSubModels<Schema extends SchemaDef, Model extends GetModels<Schema>> = GetModel<Schema, Model>['subModels'] extends string[] ? Extract<GetModel<Schema, Model>['subModels'][number], GetModels<Schema>> : never;
|
|
157
166
|
type GetModel<Schema extends SchemaDef, Model extends GetModels<Schema>> = Schema['models'][Model];
|
|
158
167
|
type GetEnums<Schema extends SchemaDef> = keyof Schema['enums'];
|
|
159
|
-
type GetEnum<Schema extends SchemaDef, Enum extends GetEnums<Schema>> = Schema['enums'][Enum];
|
|
168
|
+
type GetEnum<Schema extends SchemaDef, Enum extends GetEnums<Schema>> = Schema['enums'][Enum] extends EnumDef ? Schema['enums'][Enum]['values'] : never;
|
|
160
169
|
type GetTypeDefs<Schema extends SchemaDef> = Extract<keyof Schema['typeDefs'], string>;
|
|
161
170
|
type GetTypeDef<Schema extends SchemaDef, TypeDef extends GetTypeDefs<Schema>> = Schema['typeDefs'] extends Record<string, unknown> ? Schema['typeDefs'][TypeDef] : never;
|
|
162
171
|
type GetModelFields<Schema extends SchemaDef, Model extends GetModels<Schema>> = Extract<keyof GetModel<Schema, Model>['fields'], string>;
|
|
@@ -194,4 +203,4 @@ type IsDelegateModel<Schema extends SchemaDef, Model extends GetModels<Schema>>
|
|
|
194
203
|
type FieldIsDelegateRelation<Schema extends SchemaDef, Model extends GetModels<Schema>, Field extends RelationFields<Schema, Model>> = GetModelFieldType<Schema, Model, Field> extends GetModels<Schema> ? IsDelegateModel<Schema, GetModelFieldType<Schema, Model, Field>> : false;
|
|
195
204
|
type FieldIsDelegateDiscriminator<Schema extends SchemaDef, Model extends GetModels<Schema>, Field extends GetModelFields<Schema, Model>> = GetModelField<Schema, Model, Field>['isDiscriminator'] extends true ? true : false;
|
|
196
205
|
|
|
197
|
-
export { type ArrayExpression, type AttributeApplication, type AttributeArg, type BinaryExpression, type BinaryOperator, type BuiltinType, type CallExpression, type CascadeAction, type DataSourceProvider, type DataSourceProviderType, type EnumDef, type Expression, ExpressionUtils, type FieldDef, type FieldExpression, type FieldHasDefault, type FieldIsArray, type FieldIsComputed, type FieldIsDelegateDiscriminator, type FieldIsDelegateRelation, type FieldIsRelation, type FieldIsRelationArray, type FieldType, type ForeignKeyFields, type GetDelegateModels, type GetEnum, type GetEnums, type GetModel, type GetModelDiscriminator, type GetModelField, type GetModelFieldType, type GetModelFields, type GetModels, type GetSubModels, type GetTypeDef, type GetTypeDefField, type GetTypeDefFields, type GetTypeDefs, type IsDelegateModel, type LiteralExpression, type MappedBuiltinType, type MemberExpression, type ModelDef, type ModelFieldIsOptional, type NonRelationFields, type NullExpression, type ProcedureDef, type ProcedureParam, type RelationFieldType, type RelationFields, type RelationInfo, type ScalarFields, type SchemaDef, type ThisExpression, type TypeDefDef, type TypeDefFieldIsOptional, type UnaryExpression, type UnaryOperator };
|
|
206
|
+
export { type ArrayExpression, type AttributeApplication, type AttributeArg, type BinaryExpression, type BinaryOperator, type BuiltinType, type CallExpression, type CascadeAction, type DataSourceProvider, type DataSourceProviderType, type EnumDef, type EnumField, type Expression, ExpressionUtils, type FieldDef, type FieldExpression, type FieldHasDefault, type FieldIsArray, type FieldIsComputed, type FieldIsDelegateDiscriminator, type FieldIsDelegateRelation, type FieldIsRelation, type FieldIsRelationArray, type FieldType, type ForeignKeyFields, type GetDelegateModels, type GetEnum, type GetEnums, type GetModel, type GetModelDiscriminator, type GetModelField, type GetModelFieldType, type GetModelFields, type GetModels, type GetSubModels, type GetTypeDef, type GetTypeDefField, type GetTypeDefFields, type GetTypeDefs, type IsDelegateModel, type LiteralExpression, type MappedBuiltinType, type MemberExpression, type ModelDef, type ModelFieldIsOptional, type NonRelationFields, type NullExpression, type ProcedureDef, type ProcedureParam, type RelationFieldType, type RelationFields, type RelationInfo, type ScalarFields, type SchemaDef, type ThisExpression, type TypeDefDef, type TypeDefFieldIsOptional, type UnaryExpression, type UnaryOperator };
|
package/dist/index.d.ts
CHANGED
|
@@ -75,6 +75,7 @@ declare const ExpressionUtils: {
|
|
|
75
75
|
type DataSourceProviderType = 'sqlite' | 'postgresql';
|
|
76
76
|
type DataSourceProvider = {
|
|
77
77
|
type: DataSourceProviderType;
|
|
78
|
+
defaultSchema?: string;
|
|
78
79
|
};
|
|
79
80
|
type SchemaDef = {
|
|
80
81
|
provider: DataSourceProvider;
|
|
@@ -143,7 +144,15 @@ type ProcedureDef = {
|
|
|
143
144
|
};
|
|
144
145
|
type BuiltinType = 'String' | 'Boolean' | 'Int' | 'Float' | 'BigInt' | 'Decimal' | 'DateTime' | 'Bytes' | 'Json' | 'Unsupported';
|
|
145
146
|
type MappedBuiltinType = string | boolean | number | bigint | Decimal | Date;
|
|
146
|
-
type
|
|
147
|
+
type EnumField = {
|
|
148
|
+
name: string;
|
|
149
|
+
attributes?: AttributeApplication[];
|
|
150
|
+
};
|
|
151
|
+
type EnumDef = {
|
|
152
|
+
fields?: Record<string, EnumField>;
|
|
153
|
+
values: Record<string, string>;
|
|
154
|
+
attributes?: AttributeApplication[];
|
|
155
|
+
};
|
|
147
156
|
type TypeDefDef = {
|
|
148
157
|
name: string;
|
|
149
158
|
fields: Record<string, FieldDef>;
|
|
@@ -156,7 +165,7 @@ type GetDelegateModels<Schema extends SchemaDef> = keyof {
|
|
|
156
165
|
type GetSubModels<Schema extends SchemaDef, Model extends GetModels<Schema>> = GetModel<Schema, Model>['subModels'] extends string[] ? Extract<GetModel<Schema, Model>['subModels'][number], GetModels<Schema>> : never;
|
|
157
166
|
type GetModel<Schema extends SchemaDef, Model extends GetModels<Schema>> = Schema['models'][Model];
|
|
158
167
|
type GetEnums<Schema extends SchemaDef> = keyof Schema['enums'];
|
|
159
|
-
type GetEnum<Schema extends SchemaDef, Enum extends GetEnums<Schema>> = Schema['enums'][Enum];
|
|
168
|
+
type GetEnum<Schema extends SchemaDef, Enum extends GetEnums<Schema>> = Schema['enums'][Enum] extends EnumDef ? Schema['enums'][Enum]['values'] : never;
|
|
160
169
|
type GetTypeDefs<Schema extends SchemaDef> = Extract<keyof Schema['typeDefs'], string>;
|
|
161
170
|
type GetTypeDef<Schema extends SchemaDef, TypeDef extends GetTypeDefs<Schema>> = Schema['typeDefs'] extends Record<string, unknown> ? Schema['typeDefs'][TypeDef] : never;
|
|
162
171
|
type GetModelFields<Schema extends SchemaDef, Model extends GetModels<Schema>> = Extract<keyof GetModel<Schema, Model>['fields'], string>;
|
|
@@ -194,4 +203,4 @@ type IsDelegateModel<Schema extends SchemaDef, Model extends GetModels<Schema>>
|
|
|
194
203
|
type FieldIsDelegateRelation<Schema extends SchemaDef, Model extends GetModels<Schema>, Field extends RelationFields<Schema, Model>> = GetModelFieldType<Schema, Model, Field> extends GetModels<Schema> ? IsDelegateModel<Schema, GetModelFieldType<Schema, Model, Field>> : false;
|
|
195
204
|
type FieldIsDelegateDiscriminator<Schema extends SchemaDef, Model extends GetModels<Schema>, Field extends GetModelFields<Schema, Model>> = GetModelField<Schema, Model, Field>['isDiscriminator'] extends true ? true : false;
|
|
196
205
|
|
|
197
|
-
export { type ArrayExpression, type AttributeApplication, type AttributeArg, type BinaryExpression, type BinaryOperator, type BuiltinType, type CallExpression, type CascadeAction, type DataSourceProvider, type DataSourceProviderType, type EnumDef, type Expression, ExpressionUtils, type FieldDef, type FieldExpression, type FieldHasDefault, type FieldIsArray, type FieldIsComputed, type FieldIsDelegateDiscriminator, type FieldIsDelegateRelation, type FieldIsRelation, type FieldIsRelationArray, type FieldType, type ForeignKeyFields, type GetDelegateModels, type GetEnum, type GetEnums, type GetModel, type GetModelDiscriminator, type GetModelField, type GetModelFieldType, type GetModelFields, type GetModels, type GetSubModels, type GetTypeDef, type GetTypeDefField, type GetTypeDefFields, type GetTypeDefs, type IsDelegateModel, type LiteralExpression, type MappedBuiltinType, type MemberExpression, type ModelDef, type ModelFieldIsOptional, type NonRelationFields, type NullExpression, type ProcedureDef, type ProcedureParam, type RelationFieldType, type RelationFields, type RelationInfo, type ScalarFields, type SchemaDef, type ThisExpression, type TypeDefDef, type TypeDefFieldIsOptional, type UnaryExpression, type UnaryOperator };
|
|
206
|
+
export { type ArrayExpression, type AttributeApplication, type AttributeArg, type BinaryExpression, type BinaryOperator, type BuiltinType, type CallExpression, type CascadeAction, type DataSourceProvider, type DataSourceProviderType, type EnumDef, type EnumField, type Expression, ExpressionUtils, type FieldDef, type FieldExpression, type FieldHasDefault, type FieldIsArray, type FieldIsComputed, type FieldIsDelegateDiscriminator, type FieldIsDelegateRelation, type FieldIsRelation, type FieldIsRelationArray, type FieldType, type ForeignKeyFields, type GetDelegateModels, type GetEnum, type GetEnums, type GetModel, type GetModelDiscriminator, type GetModelField, type GetModelFieldType, type GetModelFields, type GetModels, type GetSubModels, type GetTypeDef, type GetTypeDefField, type GetTypeDefFields, type GetTypeDefs, type IsDelegateModel, type LiteralExpression, type MappedBuiltinType, type MemberExpression, type ModelDef, type ModelFieldIsOptional, type NonRelationFields, type NullExpression, type ProcedureDef, type ProcedureParam, type RelationFieldType, type RelationFields, type RelationInfo, type ScalarFields, type SchemaDef, type ThisExpression, type TypeDefDef, type TypeDefFieldIsOptional, type UnaryExpression, type UnaryOperator };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zenstackhq/schema",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.21",
|
|
4
4
|
"description": "ZenStack Runtime Schema",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [],
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
"decimal.js": "^10.4.3"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@zenstackhq/eslint-config": "3.0.0-beta.
|
|
29
|
-
"@zenstackhq/typescript-config": "3.0.0-beta.
|
|
28
|
+
"@zenstackhq/eslint-config": "3.0.0-beta.21",
|
|
29
|
+
"@zenstackhq/typescript-config": "3.0.0-beta.21"
|
|
30
30
|
},
|
|
31
31
|
"scripts": {
|
|
32
32
|
"build": "tsc --noEmit && tsup-node",
|