@zenstackhq/schema 3.7.0 → 3.7.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 +3 -1
- package/dist/index.d.mts +3 -1
- package/package.json +5 -5
package/dist/index.d.cts
CHANGED
|
@@ -77,6 +77,7 @@ type ModelDef = {
|
|
|
77
77
|
isDelegate?: boolean;
|
|
78
78
|
subModels?: readonly string[];
|
|
79
79
|
isView?: boolean;
|
|
80
|
+
delegateMap?: string;
|
|
80
81
|
};
|
|
81
82
|
type AttributeApplication = {
|
|
82
83
|
name: string;
|
|
@@ -159,6 +160,7 @@ type GetTypeDef<Schema extends SchemaDef, TypeDef extends GetTypeDefs<Schema>> =
|
|
|
159
160
|
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 };
|
|
160
161
|
type GetModelField<Schema extends SchemaDef, Model extends GetModels<Schema>, Field extends GetModelFields<Schema, Model>> = GetModel<Schema, Model>['fields'][Field];
|
|
161
162
|
type GetModelDiscriminator<Schema extends SchemaDef, Model extends GetModels<Schema>> = keyof { [Key in GetModelFields<Schema, Model> as FieldIsDelegateDiscriminator<Schema, Model, Key> extends true ? GetModelField<Schema, Model, Key>['originModel'] extends string ? never : Key : never]: true };
|
|
163
|
+
type GetModelDelegateMapValue<Schema extends SchemaDef, Model extends GetModels<Schema>> = Exclude<GetModel<Schema, Model>['delegateMap'], undefined> extends never ? Model : Exclude<GetModel<Schema, Model>['delegateMap'], undefined>;
|
|
162
164
|
type GetModelFieldType<Schema extends SchemaDef, Model extends GetModels<Schema>, Field extends GetModelFields<Schema, Model>> = Schema['models'][Model]['fields'][Field]['type'];
|
|
163
165
|
type GetTypeDefFields<Schema extends SchemaDef, TypeDef extends GetTypeDefs<Schema>> = Extract<keyof GetTypeDef<Schema, TypeDef>['fields'], string>;
|
|
164
166
|
type GetTypeDefField<Schema extends SchemaDef, TypeDef extends GetTypeDefs<Schema>, Field extends GetTypeDefFields<Schema, TypeDef>> = GetTypeDef<Schema, TypeDef>['fields'][Field];
|
|
@@ -287,5 +289,5 @@ declare const ExpressionUtils: {
|
|
|
287
289
|
getLiteralValue: (expr: Expression) => string | number | boolean | undefined;
|
|
288
290
|
};
|
|
289
291
|
//#endregion
|
|
290
|
-
export { ArrayExpression, AttributeApplication, AttributeArg, BinaryExpression, BinaryOperator, BindingExpression, BuiltinType, CallExpression, CascadeAction, DataSourceProvider, DataSourceProviderType, EnumDef, EnumField, Expression, ExpressionUtils, FieldDef, FieldDefault, FieldExpression, FieldHasDefault, FieldIsArray, FieldIsComputed, FieldIsDelegateDiscriminator, FieldIsDelegateRelation, FieldIsRelation, FieldIsRelationArray, FieldIsUnsupported, FieldType, ForeignKeyFields, GetDelegateModels, GetEnum, GetEnums, GetModel, GetModelDiscriminator, GetModelField, GetModelFieldType, GetModelFields, GetModels, GetSubModels, GetTypeDef, GetTypeDefField, GetTypeDefFieldType, GetTypeDefFields, GetTypeDefs, InvalidSchemaError, IsDelegateModel, LiteralExpression, MappedBuiltinType, MemberExpression, ModelDef, ModelFieldIsOptional, NonRelationFields, NullExpression, ProcedureDef, ProcedureParam, RelationFieldType, RelationFields, RelationInfo, ScalarFields, SchemaAccessor, SchemaDef, ThisExpression, TypeDefDef, TypeDefFieldIsArray, TypeDefFieldIsOptional, UnaryExpression, UnaryOperator, UniqueFieldsInfo, UpdatedAtInfo };
|
|
292
|
+
export { ArrayExpression, AttributeApplication, AttributeArg, BinaryExpression, BinaryOperator, BindingExpression, BuiltinType, CallExpression, CascadeAction, DataSourceProvider, DataSourceProviderType, EnumDef, EnumField, Expression, ExpressionUtils, FieldDef, FieldDefault, FieldExpression, FieldHasDefault, FieldIsArray, FieldIsComputed, FieldIsDelegateDiscriminator, FieldIsDelegateRelation, FieldIsRelation, FieldIsRelationArray, FieldIsUnsupported, FieldType, ForeignKeyFields, GetDelegateModels, GetEnum, GetEnums, GetModel, GetModelDelegateMapValue, GetModelDiscriminator, GetModelField, GetModelFieldType, GetModelFields, GetModels, GetSubModels, GetTypeDef, GetTypeDefField, GetTypeDefFieldType, GetTypeDefFields, GetTypeDefs, InvalidSchemaError, IsDelegateModel, LiteralExpression, MappedBuiltinType, MemberExpression, ModelDef, ModelFieldIsOptional, NonRelationFields, NullExpression, ProcedureDef, ProcedureParam, RelationFieldType, RelationFields, RelationInfo, ScalarFields, SchemaAccessor, SchemaDef, ThisExpression, TypeDefDef, TypeDefFieldIsArray, TypeDefFieldIsOptional, UnaryExpression, UnaryOperator, UniqueFieldsInfo, UpdatedAtInfo };
|
|
291
293
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.mts
CHANGED
|
@@ -77,6 +77,7 @@ type ModelDef = {
|
|
|
77
77
|
isDelegate?: boolean;
|
|
78
78
|
subModels?: readonly string[];
|
|
79
79
|
isView?: boolean;
|
|
80
|
+
delegateMap?: string;
|
|
80
81
|
};
|
|
81
82
|
type AttributeApplication = {
|
|
82
83
|
name: string;
|
|
@@ -159,6 +160,7 @@ type GetTypeDef<Schema extends SchemaDef, TypeDef extends GetTypeDefs<Schema>> =
|
|
|
159
160
|
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 };
|
|
160
161
|
type GetModelField<Schema extends SchemaDef, Model extends GetModels<Schema>, Field extends GetModelFields<Schema, Model>> = GetModel<Schema, Model>['fields'][Field];
|
|
161
162
|
type GetModelDiscriminator<Schema extends SchemaDef, Model extends GetModels<Schema>> = keyof { [Key in GetModelFields<Schema, Model> as FieldIsDelegateDiscriminator<Schema, Model, Key> extends true ? GetModelField<Schema, Model, Key>['originModel'] extends string ? never : Key : never]: true };
|
|
163
|
+
type GetModelDelegateMapValue<Schema extends SchemaDef, Model extends GetModels<Schema>> = Exclude<GetModel<Schema, Model>['delegateMap'], undefined> extends never ? Model : Exclude<GetModel<Schema, Model>['delegateMap'], undefined>;
|
|
162
164
|
type GetModelFieldType<Schema extends SchemaDef, Model extends GetModels<Schema>, Field extends GetModelFields<Schema, Model>> = Schema['models'][Model]['fields'][Field]['type'];
|
|
163
165
|
type GetTypeDefFields<Schema extends SchemaDef, TypeDef extends GetTypeDefs<Schema>> = Extract<keyof GetTypeDef<Schema, TypeDef>['fields'], string>;
|
|
164
166
|
type GetTypeDefField<Schema extends SchemaDef, TypeDef extends GetTypeDefs<Schema>, Field extends GetTypeDefFields<Schema, TypeDef>> = GetTypeDef<Schema, TypeDef>['fields'][Field];
|
|
@@ -287,5 +289,5 @@ declare const ExpressionUtils: {
|
|
|
287
289
|
getLiteralValue: (expr: Expression) => string | number | boolean | undefined;
|
|
288
290
|
};
|
|
289
291
|
//#endregion
|
|
290
|
-
export { ArrayExpression, AttributeApplication, AttributeArg, BinaryExpression, BinaryOperator, BindingExpression, BuiltinType, CallExpression, CascadeAction, DataSourceProvider, DataSourceProviderType, EnumDef, EnumField, Expression, ExpressionUtils, FieldDef, FieldDefault, FieldExpression, FieldHasDefault, FieldIsArray, FieldIsComputed, FieldIsDelegateDiscriminator, FieldIsDelegateRelation, FieldIsRelation, FieldIsRelationArray, FieldIsUnsupported, FieldType, ForeignKeyFields, GetDelegateModels, GetEnum, GetEnums, GetModel, GetModelDiscriminator, GetModelField, GetModelFieldType, GetModelFields, GetModels, GetSubModels, GetTypeDef, GetTypeDefField, GetTypeDefFieldType, GetTypeDefFields, GetTypeDefs, InvalidSchemaError, IsDelegateModel, LiteralExpression, MappedBuiltinType, MemberExpression, ModelDef, ModelFieldIsOptional, NonRelationFields, NullExpression, ProcedureDef, ProcedureParam, RelationFieldType, RelationFields, RelationInfo, ScalarFields, SchemaAccessor, SchemaDef, ThisExpression, TypeDefDef, TypeDefFieldIsArray, TypeDefFieldIsOptional, UnaryExpression, UnaryOperator, UniqueFieldsInfo, UpdatedAtInfo };
|
|
292
|
+
export { ArrayExpression, AttributeApplication, AttributeArg, BinaryExpression, BinaryOperator, BindingExpression, BuiltinType, CallExpression, CascadeAction, DataSourceProvider, DataSourceProviderType, EnumDef, EnumField, Expression, ExpressionUtils, FieldDef, FieldDefault, FieldExpression, FieldHasDefault, FieldIsArray, FieldIsComputed, FieldIsDelegateDiscriminator, FieldIsDelegateRelation, FieldIsRelation, FieldIsRelationArray, FieldIsUnsupported, FieldType, ForeignKeyFields, GetDelegateModels, GetEnum, GetEnums, GetModel, GetModelDelegateMapValue, GetModelDiscriminator, GetModelField, GetModelFieldType, GetModelFields, GetModels, GetSubModels, GetTypeDef, GetTypeDefField, GetTypeDefFieldType, GetTypeDefFields, GetTypeDefs, InvalidSchemaError, IsDelegateModel, LiteralExpression, MappedBuiltinType, MemberExpression, ModelDef, ModelFieldIsOptional, NonRelationFields, NullExpression, ProcedureDef, ProcedureParam, RelationFieldType, RelationFields, RelationInfo, ScalarFields, SchemaAccessor, SchemaDef, ThisExpression, TypeDefDef, TypeDefFieldIsArray, TypeDefFieldIsOptional, UnaryExpression, UnaryOperator, UniqueFieldsInfo, UpdatedAtInfo };
|
|
291
293
|
//# sourceMappingURL=index.d.mts.map
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@zenstackhq/schema",
|
|
3
3
|
"displayName": "ZenStack Schema Object Model",
|
|
4
4
|
"description": "TypeScript representation of ZModel schema",
|
|
5
|
-
"version": "3.7.
|
|
5
|
+
"version": "3.7.2",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"author": {
|
|
8
8
|
"name": "ZenStack Team",
|
|
@@ -38,10 +38,10 @@
|
|
|
38
38
|
"decimal.js": "^10.4.3"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@zenstackhq/eslint-config": "3.7.
|
|
42
|
-
"@zenstackhq/
|
|
43
|
-
"@zenstackhq/
|
|
44
|
-
"@zenstackhq/vitest-config": "3.7.
|
|
41
|
+
"@zenstackhq/eslint-config": "3.7.2",
|
|
42
|
+
"@zenstackhq/tsdown-config": "3.7.2",
|
|
43
|
+
"@zenstackhq/typescript-config": "3.7.2",
|
|
44
|
+
"@zenstackhq/vitest-config": "3.7.2"
|
|
45
45
|
},
|
|
46
46
|
"funding": "https://github.com/sponsors/zenstackhq",
|
|
47
47
|
"scripts": {
|