@zenstackhq/schema
Advanced tools
+5
-2
@@ -157,3 +157,5 @@ import Decimal from 'decimal.js'; | ||
| type GetTypeDef<Schema extends SchemaDef, TypeDef extends GetTypeDefs<Schema>> = Schema['typeDefs'] extends Record<string, unknown> ? Schema['typeDefs'][TypeDef] : never; | ||
| type GetModelFields<Schema extends SchemaDef, Model extends GetModels<Schema>> = Extract<keyof GetModel<Schema, Model>['fields'], string>; | ||
| type GetModelFields<Schema extends SchemaDef, Model extends GetModels<Schema>> = keyof { | ||
| [Key in Extract<keyof GetModel<Schema, Model>['fields'], string> as FieldIsUnsupported<Schema, Model, Key> extends true ? never : Key]: never; | ||
| }; | ||
| type GetModelField<Schema extends SchemaDef, Model extends GetModels<Schema>, Field extends GetModelFields<Schema, Model>> = GetModel<Schema, Model>['fields'][Field]; | ||
@@ -187,2 +189,3 @@ type GetModelDiscriminator<Schema extends SchemaDef, Model extends GetModels<Schema>> = keyof { | ||
| type FieldIsComputed<Schema extends SchemaDef, Model extends GetModels<Schema>, Field extends GetModelFields<Schema, Model>> = GetModelField<Schema, Model, Field>['computed'] extends true ? true : false; | ||
| type FieldIsUnsupported<Schema extends SchemaDef, Model extends GetModels<Schema>, Field extends string> = Field extends keyof GetModel<Schema, Model>['fields'] ? GetModel<Schema, Model>['fields'][Field]['type'] extends 'Unsupported' ? true : false : never; | ||
| type FieldHasDefault<Schema extends SchemaDef, Model extends GetModels<Schema>, Field extends GetModelFields<Schema, Model>> = 'default' extends keyof GetModelField<Schema, Model, Field> ? true : GetModelField<Schema, Model, Field>['updatedAt'] extends true | UpdatedAtInfo ? true : GetModelField<Schema, Model, Field>['relation'] extends { | ||
@@ -297,2 +300,2 @@ hasDefault: true; | ||
| export { type ArrayExpression, type AttributeApplication, type AttributeArg, type BinaryExpression, type BinaryOperator, type BindingExpression, type BuiltinType, type CallExpression, type CascadeAction, type DataSourceProvider, type DataSourceProviderType, type EnumDef, type EnumField, type Expression, ExpressionUtils, type FieldDef, type FieldDefault, 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 GetTypeDefFieldType, type GetTypeDefFields, type GetTypeDefs, InvalidSchemaError, 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, SchemaAccessor, type SchemaDef, type ThisExpression, type TypeDefDef, type TypeDefFieldIsArray, type TypeDefFieldIsOptional, type UnaryExpression, type UnaryOperator, type UniqueFieldsInfo, type UpdatedAtInfo }; | ||
| export { type ArrayExpression, type AttributeApplication, type AttributeArg, type BinaryExpression, type BinaryOperator, type BindingExpression, type BuiltinType, type CallExpression, type CascadeAction, type DataSourceProvider, type DataSourceProviderType, type EnumDef, type EnumField, type Expression, ExpressionUtils, type FieldDef, type FieldDefault, type FieldExpression, type FieldHasDefault, type FieldIsArray, type FieldIsComputed, type FieldIsDelegateDiscriminator, type FieldIsDelegateRelation, type FieldIsRelation, type FieldIsRelationArray, type FieldIsUnsupported, 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 GetTypeDefFieldType, type GetTypeDefFields, type GetTypeDefs, InvalidSchemaError, 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, SchemaAccessor, type SchemaDef, type ThisExpression, type TypeDefDef, type TypeDefFieldIsArray, type TypeDefFieldIsOptional, type UnaryExpression, type UnaryOperator, type UniqueFieldsInfo, type UpdatedAtInfo }; |
+5
-2
@@ -157,3 +157,5 @@ import Decimal from 'decimal.js'; | ||
| type GetTypeDef<Schema extends SchemaDef, TypeDef extends GetTypeDefs<Schema>> = Schema['typeDefs'] extends Record<string, unknown> ? Schema['typeDefs'][TypeDef] : never; | ||
| type GetModelFields<Schema extends SchemaDef, Model extends GetModels<Schema>> = Extract<keyof GetModel<Schema, Model>['fields'], string>; | ||
| type GetModelFields<Schema extends SchemaDef, Model extends GetModels<Schema>> = keyof { | ||
| [Key in Extract<keyof GetModel<Schema, Model>['fields'], string> as FieldIsUnsupported<Schema, Model, Key> extends true ? never : Key]: never; | ||
| }; | ||
| type GetModelField<Schema extends SchemaDef, Model extends GetModels<Schema>, Field extends GetModelFields<Schema, Model>> = GetModel<Schema, Model>['fields'][Field]; | ||
@@ -187,2 +189,3 @@ type GetModelDiscriminator<Schema extends SchemaDef, Model extends GetModels<Schema>> = keyof { | ||
| type FieldIsComputed<Schema extends SchemaDef, Model extends GetModels<Schema>, Field extends GetModelFields<Schema, Model>> = GetModelField<Schema, Model, Field>['computed'] extends true ? true : false; | ||
| type FieldIsUnsupported<Schema extends SchemaDef, Model extends GetModels<Schema>, Field extends string> = Field extends keyof GetModel<Schema, Model>['fields'] ? GetModel<Schema, Model>['fields'][Field]['type'] extends 'Unsupported' ? true : false : never; | ||
| type FieldHasDefault<Schema extends SchemaDef, Model extends GetModels<Schema>, Field extends GetModelFields<Schema, Model>> = 'default' extends keyof GetModelField<Schema, Model, Field> ? true : GetModelField<Schema, Model, Field>['updatedAt'] extends true | UpdatedAtInfo ? true : GetModelField<Schema, Model, Field>['relation'] extends { | ||
@@ -297,2 +300,2 @@ hasDefault: true; | ||
| export { type ArrayExpression, type AttributeApplication, type AttributeArg, type BinaryExpression, type BinaryOperator, type BindingExpression, type BuiltinType, type CallExpression, type CascadeAction, type DataSourceProvider, type DataSourceProviderType, type EnumDef, type EnumField, type Expression, ExpressionUtils, type FieldDef, type FieldDefault, 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 GetTypeDefFieldType, type GetTypeDefFields, type GetTypeDefs, InvalidSchemaError, 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, SchemaAccessor, type SchemaDef, type ThisExpression, type TypeDefDef, type TypeDefFieldIsArray, type TypeDefFieldIsOptional, type UnaryExpression, type UnaryOperator, type UniqueFieldsInfo, type UpdatedAtInfo }; | ||
| export { type ArrayExpression, type AttributeApplication, type AttributeArg, type BinaryExpression, type BinaryOperator, type BindingExpression, type BuiltinType, type CallExpression, type CascadeAction, type DataSourceProvider, type DataSourceProviderType, type EnumDef, type EnumField, type Expression, ExpressionUtils, type FieldDef, type FieldDefault, type FieldExpression, type FieldHasDefault, type FieldIsArray, type FieldIsComputed, type FieldIsDelegateDiscriminator, type FieldIsDelegateRelation, type FieldIsRelation, type FieldIsRelationArray, type FieldIsUnsupported, 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 GetTypeDefFieldType, type GetTypeDefFields, type GetTypeDefs, InvalidSchemaError, 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, SchemaAccessor, type SchemaDef, type ThisExpression, type TypeDefDef, type TypeDefFieldIsArray, type TypeDefFieldIsOptional, type UnaryExpression, type UnaryOperator, type UniqueFieldsInfo, type UpdatedAtInfo }; |
+4
-4
| { | ||
| "name": "@zenstackhq/schema", | ||
| "version": "3.5.0-beta.3", | ||
| "version": "3.5.0-beta.4", | ||
| "description": "ZenStack Runtime Schema", | ||
@@ -32,5 +32,5 @@ "type": "module", | ||
| "devDependencies": { | ||
| "@zenstackhq/eslint-config": "3.5.0-beta.3", | ||
| "@zenstackhq/typescript-config": "3.5.0-beta.3", | ||
| "@zenstackhq/vitest-config": "3.5.0-beta.3" | ||
| "@zenstackhq/typescript-config": "3.5.0-beta.4", | ||
| "@zenstackhq/vitest-config": "3.5.0-beta.4", | ||
| "@zenstackhq/eslint-config": "3.5.0-beta.4" | ||
| }, | ||
@@ -37,0 +37,0 @@ "scripts": { |
87481
0.88%792
0.38%