@zenstackhq/schema 3.0.0-beta.25 → 3.0.0-beta.26
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 +4 -2
- package/dist/index.d.ts +4 -2
- package/package.json +3 -3
package/dist/index.d.cts
CHANGED
|
@@ -84,7 +84,7 @@ type SchemaDef = {
|
|
|
84
84
|
typeDefs?: Record<string, TypeDefDef>;
|
|
85
85
|
plugins: Record<string, unknown>;
|
|
86
86
|
procedures?: Record<string, ProcedureDef>;
|
|
87
|
-
authType?: GetModels<SchemaDef>;
|
|
87
|
+
authType?: GetModels<SchemaDef> | GetTypeDefs<SchemaDef>;
|
|
88
88
|
};
|
|
89
89
|
type ModelDef = {
|
|
90
90
|
name: string;
|
|
@@ -126,6 +126,7 @@ type FieldDef = {
|
|
|
126
126
|
updatedAt?: boolean;
|
|
127
127
|
attributes?: AttributeApplication[];
|
|
128
128
|
default?: MappedBuiltinType | Expression | unknown[];
|
|
129
|
+
omit?: boolean;
|
|
129
130
|
relation?: RelationInfo;
|
|
130
131
|
foreignKeyFor?: string[];
|
|
131
132
|
computed?: boolean;
|
|
@@ -192,6 +193,7 @@ type FieldType<Schema extends SchemaDef, Model extends GetModels<Schema>, Field
|
|
|
192
193
|
type RelationFieldType<Schema extends SchemaDef, Model extends GetModels<Schema>, Field extends RelationFields<Schema, Model>> = GetModelField<Schema, Model, Field>['type'] extends GetModels<Schema> ? GetModelField<Schema, Model, Field>['type'] : never;
|
|
193
194
|
type ModelFieldIsOptional<Schema extends SchemaDef, Model extends GetModels<Schema>, Field extends GetModelFields<Schema, Model>> = GetModelField<Schema, Model, Field>['optional'] extends true ? true : false;
|
|
194
195
|
type TypeDefFieldIsOptional<Schema extends SchemaDef, TypeDef extends GetTypeDefs<Schema>, Field extends GetTypeDefFields<Schema, TypeDef>> = GetTypeDefField<Schema, TypeDef, Field>['optional'] extends true ? true : false;
|
|
196
|
+
type TypeDefFieldIsArray<Schema extends SchemaDef, TypeDef extends GetTypeDefs<Schema>, Field extends GetTypeDefFields<Schema, TypeDef>> = GetTypeDefField<Schema, TypeDef, Field>['array'] extends true ? true : false;
|
|
195
197
|
type FieldIsRelation<Schema extends SchemaDef, Model extends GetModels<Schema>, Field extends GetModelFields<Schema, Model>> = GetModelField<Schema, Model, Field>['relation'] extends object ? true : false;
|
|
196
198
|
type FieldIsArray<Schema extends SchemaDef, Model extends GetModels<Schema>, Field extends GetModelFields<Schema, Model>> = GetModelField<Schema, Model, Field>['array'] extends true ? true : false;
|
|
197
199
|
type FieldIsComputed<Schema extends SchemaDef, Model extends GetModels<Schema>, Field extends GetModelFields<Schema, Model>> = GetModelField<Schema, Model, Field>['computed'] extends true ? true : false;
|
|
@@ -203,4 +205,4 @@ type IsDelegateModel<Schema extends SchemaDef, Model extends GetModels<Schema>>
|
|
|
203
205
|
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;
|
|
204
206
|
type FieldIsDelegateDiscriminator<Schema extends SchemaDef, Model extends GetModels<Schema>, Field extends GetModelFields<Schema, Model>> = GetModelField<Schema, Model, Field>['isDiscriminator'] extends true ? true : false;
|
|
205
207
|
|
|
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 };
|
|
208
|
+
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 TypeDefFieldIsArray, type TypeDefFieldIsOptional, type UnaryExpression, type UnaryOperator };
|
package/dist/index.d.ts
CHANGED
|
@@ -84,7 +84,7 @@ type SchemaDef = {
|
|
|
84
84
|
typeDefs?: Record<string, TypeDefDef>;
|
|
85
85
|
plugins: Record<string, unknown>;
|
|
86
86
|
procedures?: Record<string, ProcedureDef>;
|
|
87
|
-
authType?: GetModels<SchemaDef>;
|
|
87
|
+
authType?: GetModels<SchemaDef> | GetTypeDefs<SchemaDef>;
|
|
88
88
|
};
|
|
89
89
|
type ModelDef = {
|
|
90
90
|
name: string;
|
|
@@ -126,6 +126,7 @@ type FieldDef = {
|
|
|
126
126
|
updatedAt?: boolean;
|
|
127
127
|
attributes?: AttributeApplication[];
|
|
128
128
|
default?: MappedBuiltinType | Expression | unknown[];
|
|
129
|
+
omit?: boolean;
|
|
129
130
|
relation?: RelationInfo;
|
|
130
131
|
foreignKeyFor?: string[];
|
|
131
132
|
computed?: boolean;
|
|
@@ -192,6 +193,7 @@ type FieldType<Schema extends SchemaDef, Model extends GetModels<Schema>, Field
|
|
|
192
193
|
type RelationFieldType<Schema extends SchemaDef, Model extends GetModels<Schema>, Field extends RelationFields<Schema, Model>> = GetModelField<Schema, Model, Field>['type'] extends GetModels<Schema> ? GetModelField<Schema, Model, Field>['type'] : never;
|
|
193
194
|
type ModelFieldIsOptional<Schema extends SchemaDef, Model extends GetModels<Schema>, Field extends GetModelFields<Schema, Model>> = GetModelField<Schema, Model, Field>['optional'] extends true ? true : false;
|
|
194
195
|
type TypeDefFieldIsOptional<Schema extends SchemaDef, TypeDef extends GetTypeDefs<Schema>, Field extends GetTypeDefFields<Schema, TypeDef>> = GetTypeDefField<Schema, TypeDef, Field>['optional'] extends true ? true : false;
|
|
196
|
+
type TypeDefFieldIsArray<Schema extends SchemaDef, TypeDef extends GetTypeDefs<Schema>, Field extends GetTypeDefFields<Schema, TypeDef>> = GetTypeDefField<Schema, TypeDef, Field>['array'] extends true ? true : false;
|
|
195
197
|
type FieldIsRelation<Schema extends SchemaDef, Model extends GetModels<Schema>, Field extends GetModelFields<Schema, Model>> = GetModelField<Schema, Model, Field>['relation'] extends object ? true : false;
|
|
196
198
|
type FieldIsArray<Schema extends SchemaDef, Model extends GetModels<Schema>, Field extends GetModelFields<Schema, Model>> = GetModelField<Schema, Model, Field>['array'] extends true ? true : false;
|
|
197
199
|
type FieldIsComputed<Schema extends SchemaDef, Model extends GetModels<Schema>, Field extends GetModelFields<Schema, Model>> = GetModelField<Schema, Model, Field>['computed'] extends true ? true : false;
|
|
@@ -203,4 +205,4 @@ type IsDelegateModel<Schema extends SchemaDef, Model extends GetModels<Schema>>
|
|
|
203
205
|
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;
|
|
204
206
|
type FieldIsDelegateDiscriminator<Schema extends SchemaDef, Model extends GetModels<Schema>, Field extends GetModelFields<Schema, Model>> = GetModelField<Schema, Model, Field>['isDiscriminator'] extends true ? true : false;
|
|
205
207
|
|
|
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 };
|
|
208
|
+
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 TypeDefFieldIsArray, 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.26",
|
|
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.26",
|
|
29
|
+
"@zenstackhq/typescript-config": "3.0.0-beta.26"
|
|
30
30
|
},
|
|
31
31
|
"scripts": {
|
|
32
32
|
"build": "tsc --noEmit && tsup-node",
|