@zenstackhq/schema 3.4.6 → 3.5.0-beta.2
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 -3
- package/dist/index.d.ts +4 -3
- package/package.json +4 -4
package/dist/index.d.cts
CHANGED
|
@@ -97,6 +97,7 @@ type RelationInfo = {
|
|
|
97
97
|
type UpdatedAtInfo = {
|
|
98
98
|
ignore?: readonly string[];
|
|
99
99
|
};
|
|
100
|
+
type FieldDefault = MappedBuiltinType | Expression | readonly unknown[];
|
|
100
101
|
type FieldDef = {
|
|
101
102
|
name: string;
|
|
102
103
|
type: string;
|
|
@@ -106,7 +107,7 @@ type FieldDef = {
|
|
|
106
107
|
unique?: boolean;
|
|
107
108
|
updatedAt?: boolean | UpdatedAtInfo;
|
|
108
109
|
attributes?: readonly AttributeApplication[];
|
|
109
|
-
default?:
|
|
110
|
+
default?: FieldDefault;
|
|
110
111
|
omit?: boolean;
|
|
111
112
|
relation?: RelationInfo;
|
|
112
113
|
foreignKeyFor?: readonly string[];
|
|
@@ -182,7 +183,7 @@ type TypeDefFieldIsArray<Schema extends SchemaDef, TypeDef extends GetTypeDefs<S
|
|
|
182
183
|
type FieldIsRelation<Schema extends SchemaDef, Model extends GetModels<Schema>, Field extends GetModelFields<Schema, Model>> = GetModelField<Schema, Model, Field>['relation'] extends object ? true : false;
|
|
183
184
|
type FieldIsArray<Schema extends SchemaDef, Model extends GetModels<Schema>, Field extends GetModelFields<Schema, Model>> = GetModelField<Schema, Model, Field>['array'] extends true ? true : false;
|
|
184
185
|
type FieldIsComputed<Schema extends SchemaDef, Model extends GetModels<Schema>, Field extends GetModelFields<Schema, Model>> = GetModelField<Schema, Model, Field>['computed'] extends true ? true : false;
|
|
185
|
-
type FieldHasDefault<Schema extends SchemaDef, Model extends GetModels<Schema>, Field extends GetModelFields<Schema, Model>> = GetModelField<Schema, Model, Field>
|
|
186
|
+
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 {
|
|
186
187
|
hasDefault: true;
|
|
187
188
|
} ? true : false;
|
|
188
189
|
type FieldIsRelationArray<Schema extends SchemaDef, Model extends GetModels<Schema>, Field extends GetModelFields<Schema, Model>> = FieldIsRelation<Schema, Model, Field> extends true ? FieldIsArray<Schema, Model, Field> : false;
|
|
@@ -291,4 +292,4 @@ declare const ExpressionUtils: {
|
|
|
291
292
|
getLiteralValue: (expr: Expression) => string | number | boolean | undefined;
|
|
292
293
|
};
|
|
293
294
|
|
|
294
|
-
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 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 };
|
|
295
|
+
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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -97,6 +97,7 @@ type RelationInfo = {
|
|
|
97
97
|
type UpdatedAtInfo = {
|
|
98
98
|
ignore?: readonly string[];
|
|
99
99
|
};
|
|
100
|
+
type FieldDefault = MappedBuiltinType | Expression | readonly unknown[];
|
|
100
101
|
type FieldDef = {
|
|
101
102
|
name: string;
|
|
102
103
|
type: string;
|
|
@@ -106,7 +107,7 @@ type FieldDef = {
|
|
|
106
107
|
unique?: boolean;
|
|
107
108
|
updatedAt?: boolean | UpdatedAtInfo;
|
|
108
109
|
attributes?: readonly AttributeApplication[];
|
|
109
|
-
default?:
|
|
110
|
+
default?: FieldDefault;
|
|
110
111
|
omit?: boolean;
|
|
111
112
|
relation?: RelationInfo;
|
|
112
113
|
foreignKeyFor?: readonly string[];
|
|
@@ -182,7 +183,7 @@ type TypeDefFieldIsArray<Schema extends SchemaDef, TypeDef extends GetTypeDefs<S
|
|
|
182
183
|
type FieldIsRelation<Schema extends SchemaDef, Model extends GetModels<Schema>, Field extends GetModelFields<Schema, Model>> = GetModelField<Schema, Model, Field>['relation'] extends object ? true : false;
|
|
183
184
|
type FieldIsArray<Schema extends SchemaDef, Model extends GetModels<Schema>, Field extends GetModelFields<Schema, Model>> = GetModelField<Schema, Model, Field>['array'] extends true ? true : false;
|
|
184
185
|
type FieldIsComputed<Schema extends SchemaDef, Model extends GetModels<Schema>, Field extends GetModelFields<Schema, Model>> = GetModelField<Schema, Model, Field>['computed'] extends true ? true : false;
|
|
185
|
-
type FieldHasDefault<Schema extends SchemaDef, Model extends GetModels<Schema>, Field extends GetModelFields<Schema, Model>> = GetModelField<Schema, Model, Field>
|
|
186
|
+
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 {
|
|
186
187
|
hasDefault: true;
|
|
187
188
|
} ? true : false;
|
|
188
189
|
type FieldIsRelationArray<Schema extends SchemaDef, Model extends GetModels<Schema>, Field extends GetModelFields<Schema, Model>> = FieldIsRelation<Schema, Model, Field> extends true ? FieldIsArray<Schema, Model, Field> : false;
|
|
@@ -291,4 +292,4 @@ declare const ExpressionUtils: {
|
|
|
291
292
|
getLiteralValue: (expr: Expression) => string | number | boolean | undefined;
|
|
292
293
|
};
|
|
293
294
|
|
|
294
|
-
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 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 };
|
|
295
|
+
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 };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zenstackhq/schema",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.5.0-beta.2",
|
|
4
4
|
"description": "ZenStack Runtime Schema",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [],
|
|
@@ -29,9 +29,9 @@
|
|
|
29
29
|
"decimal.js": "^10.4.3"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@zenstackhq/
|
|
33
|
-
"@zenstackhq/eslint-config": "3.
|
|
34
|
-
"@zenstackhq/
|
|
32
|
+
"@zenstackhq/typescript-config": "3.5.0-beta.2",
|
|
33
|
+
"@zenstackhq/eslint-config": "3.5.0-beta.2",
|
|
34
|
+
"@zenstackhq/vitest-config": "3.5.0-beta.2"
|
|
35
35
|
},
|
|
36
36
|
"scripts": {
|
|
37
37
|
"build": "tsc --noEmit && tsup-node",
|