@zenstackhq/orm 3.9.7 → 3.9.8

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 CHANGED
@@ -1,4 +1,5 @@
1
1
  import { AnyNull, AnyNullClass, DbNull, DbNullClass, JsonArray, JsonNull, JsonNullClass, JsonNullValues, JsonObject, JsonValue } from "./common-types.cjs";
2
+ import { a as CoreCreateOperations, c as CoreReadOperations, d as FilterPropertyToKind, f as LOGICAL_COMBINATORS, i as AllWriteOperations, l as CoreUpdateOperations, n as AllCrudOperations, o as CoreCrudOperations, p as TRANSACTION_UNSUPPORTED_METHODS, r as AllReadOperations, s as CoreDeleteOperations, t as AggregateOperators, u as CoreWriteOperations } from "./constants-lRwcp6Hv.cjs";
2
3
  import * as _$kysely from "kysely";
3
4
  import { AddColumnNode, AddConstraintNode, AddIndexNode, AddValueNode, AggregateFunctionNode, AliasNode, AliasableExpression, AlterColumnNode, AlterTableNode, AlterTypeNode, AndNode, BinaryOperationNode, CaseNode, CastNode, CheckConstraintNode, CollateNode, ColumnDefinitionNode, ColumnNode, ColumnUpdateNode, CommonTableExpressionNameNode, CommonTableExpressionNode, CreateIndexNode, CreateSchemaNode, CreateTableNode, CreateTypeNode, CreateViewNode, DataTypeNode, DefaultInsertValueNode, DefaultValueNode, DeleteQueryNode, Dialect, DropColumnNode, DropConstraintNode, DropIndexNode, DropSchemaNode, DropTableNode, DropTypeNode, DropViewNode, ExplainNode, Expression, ExpressionBuilder, ExpressionWrapper, FetchNode, ForeignKeyConstraintNode, FromNode, FunctionNode, Generated, GeneratedNode, GroupByItemNode, GroupByNode, HavingNode, IdentifierNode, InsertQueryNode, JSONOperatorChainNode, JSONPathLegNode, JSONPathNode, JSONReferenceNode, JoinNode, Kysely, KyselyConfig, LimitNode, ListNode, MatchedNode, MergeQueryNode, ModifyColumnNode, OffsetNode, OnConflictNode, OnDuplicateKeyNode, OnNode, OperandExpression, OperationNode, OperationNodeVisitor, OperatorNode, OrActionNode, OrNode, OrderByItemNode, OrderByNode, OutputNode, OverNode, ParensNode, PartitionByItemNode, PartitionByNode, PrimaryKeyConstraintNode, PrimitiveValueListNode, QueryId, QueryResult, RawNode, ReferenceNode, ReferencesNode, RefreshMaterializedViewNode, RenameColumnNode, RenameConstraintNode, RenameValueNode, ReturningNode, RootOperationNode, SchemableIdentifierNode, SelectAllNode, SelectModifierNode, SelectQueryBuilder, SelectQueryNode, SelectionNode, SetOperationNode, SqlBool, TableNode, TopNode, TupleNode, UnaryOperationNode, UniqueConstraintNode, UnknownRow, UpdateQueryNode, UsingNode, ValueListNode, ValueNode, ValuesNode, WhenNode, WhereNode, WithNode } from "kysely";
4
5
  import * as _$_zenstackhq_schema0 from "@zenstackhq/schema";
@@ -162,61 +163,6 @@ type _NoExtraObject<T extends object, Shape, Keys extends PropertyKey = _ObjectK
162
163
  */
163
164
  type NoExtraProperties<T, Shape> = unknown extends Shape ? unknown : T extends _ExactLeaf ? T : T extends readonly (infer Item)[] ? [_ArrayItem<Shape>] extends [never] ? never : NoExtraProperties<Item, _ArrayItem<Shape>>[] : T extends object ? _NoExtraObject<T, Shape> : T;
164
165
  //#endregion
165
- //#region src/client/constants.d.ts
166
- /**
167
- * Client API methods that are not supported in transactions.
168
- */
169
- declare const TRANSACTION_UNSUPPORTED_METHODS: readonly ["$transaction", "$connect", "$disconnect", "$use"];
170
- /**
171
- * Logical combinators used in filters.
172
- */
173
- declare const LOGICAL_COMBINATORS: readonly ["AND", "OR", "NOT"];
174
- /**
175
- * Aggregation operators.
176
- */
177
- declare const AggregateOperators: readonly ["_count", "_sum", "_avg", "_min", "_max"];
178
- type AggregateOperators = (typeof AggregateOperators)[number];
179
- /**
180
- * Mapping of filter operators to their corresponding filter kind categories.
181
- */
182
- declare const FILTER_PROPERTY_TO_KIND: {
183
- readonly equals: "Equality";
184
- readonly not: "Equality";
185
- readonly in: "Equality";
186
- readonly notIn: "Equality";
187
- readonly lt: "Range";
188
- readonly lte: "Range";
189
- readonly gt: "Range";
190
- readonly gte: "Range";
191
- readonly between: "Range";
192
- readonly contains: "Like";
193
- readonly startsWith: "Like";
194
- readonly endsWith: "Like";
195
- readonly mode: "Like";
196
- readonly is: "Relation";
197
- readonly isNot: "Relation";
198
- readonly some: "Relation";
199
- readonly every: "Relation";
200
- readonly none: "Relation";
201
- readonly path: "Json";
202
- readonly string_contains: "Json";
203
- readonly string_starts_with: "Json";
204
- readonly string_ends_with: "Json";
205
- readonly array_contains: "Json";
206
- readonly array_starts_with: "Json";
207
- readonly array_ends_with: "Json";
208
- readonly fuzzy: "Fuzzy";
209
- readonly fts: "FullText";
210
- readonly has: "List";
211
- readonly hasEvery: "List";
212
- readonly hasSome: "List";
213
- readonly isEmpty: "List";
214
- };
215
- /**
216
- * Mapping of filter operators to their corresponding filter kind categories.
217
- */
218
- type FilterPropertyToKind = typeof FILTER_PROPERTY_TO_KIND;
219
- //#endregion
220
166
  //#region src/client/query-builder.d.ts
221
167
  type ToKyselySchema<Schema extends SchemaDef> = { [Model in GetModels<Schema>]: ToKyselyTable<Schema, Model> };
222
168
  type ToKysely<Schema extends SchemaDef> = Kysely<ToKyselySchema<Schema>>;
@@ -1043,80 +989,6 @@ declare class InputValidator<Schema extends SchemaDef> {
1043
989
  private validate;
1044
990
  }
1045
991
  //#endregion
1046
- //#region src/client/crud/operations/base.d.ts
1047
- /**
1048
- * List of core CRUD operations. It excludes the 'orThrow' variants.
1049
- */
1050
- declare const CoreCrudOperations: readonly ["findMany", "findUnique", "findFirst", "create", "createMany", "createManyAndReturn", "update", "updateMany", "updateManyAndReturn", "upsert", "delete", "deleteMany", "count", "aggregate", "groupBy", "exists"];
1051
- /**
1052
- * List of core CRUD operations. It excludes the 'orThrow' variants.
1053
- */
1054
- type CoreCrudOperations = (typeof CoreCrudOperations)[number];
1055
- /**
1056
- * List of core read operations. It excludes the 'orThrow' variants.
1057
- */
1058
- declare const CoreReadOperations: readonly ["findMany", "findUnique", "findFirst", "count", "aggregate", "groupBy", "exists"];
1059
- /**
1060
- * List of core read operations. It excludes the 'orThrow' variants.
1061
- */
1062
- type CoreReadOperations = (typeof CoreReadOperations)[number];
1063
- /**
1064
- * List of core write operations.
1065
- */
1066
- declare const CoreWriteOperations: readonly ["create", "createMany", "createManyAndReturn", "update", "updateMany", "updateManyAndReturn", "upsert", "delete", "deleteMany"];
1067
- /**
1068
- * List of core write operations.
1069
- */
1070
- type CoreWriteOperations = (typeof CoreWriteOperations)[number];
1071
- /**
1072
- * List of core create operations.
1073
- */
1074
- declare const CoreCreateOperations: readonly ["create", "createMany", "createManyAndReturn", "upsert"];
1075
- /**
1076
- * List of core create operations.
1077
- */
1078
- type CoreCreateOperations = (typeof CoreCreateOperations)[number];
1079
- /**
1080
- * List of core update operations.
1081
- */
1082
- declare const CoreUpdateOperations: readonly ["update", "updateMany", "updateManyAndReturn", "upsert"];
1083
- /**
1084
- * List of core update operations.
1085
- */
1086
- type CoreUpdateOperations = (typeof CoreUpdateOperations)[number];
1087
- /**
1088
- * List of core delete operations.
1089
- */
1090
- declare const CoreDeleteOperations: readonly ["delete", "deleteMany"];
1091
- /**
1092
- * List of core delete operations.
1093
- */
1094
- type CoreDeleteOperations = (typeof CoreDeleteOperations)[number];
1095
- /**
1096
- * List of all CRUD operations, including 'orThrow' variants.
1097
- */
1098
- declare const AllCrudOperations: readonly ["findMany", "findUnique", "findFirst", "create", "createMany", "createManyAndReturn", "update", "updateMany", "updateManyAndReturn", "upsert", "delete", "deleteMany", "count", "aggregate", "groupBy", "exists", "findUniqueOrThrow", "findFirstOrThrow"];
1099
- /**
1100
- * List of all CRUD operations, including 'orThrow' variants.
1101
- */
1102
- type AllCrudOperations = (typeof AllCrudOperations)[number];
1103
- /**
1104
- * List of all read operations, including 'orThrow' variants.
1105
- */
1106
- declare const AllReadOperations: readonly ["findMany", "findUnique", "findFirst", "count", "aggregate", "groupBy", "exists", "findUniqueOrThrow", "findFirstOrThrow"];
1107
- /**
1108
- * List of all read operations, including 'orThrow' variants.
1109
- */
1110
- type AllReadOperations = (typeof AllReadOperations)[number];
1111
- /**
1112
- * List of all write operations - simply an alias of CoreWriteOperations.
1113
- */
1114
- declare const AllWriteOperations: readonly ["create", "createMany", "createManyAndReturn", "update", "updateMany", "updateManyAndReturn", "upsert", "delete", "deleteMany"];
1115
- /**
1116
- * List of all write operations - simply an alias of CoreWriteOperations.
1117
- */
1118
- type AllWriteOperations = CoreWriteOperations;
1119
- //#endregion
1120
992
  //#region src/client/type-utils.d.ts
1121
993
  /**
1122
994
  * Checks if a model has any required Unsupported fields (non-optional, no default).
package/dist/index.d.mts CHANGED
@@ -1,7 +1,8 @@
1
1
  import { AnyNull, AnyNullClass, DbNull, DbNullClass, JsonArray, JsonNull, JsonNullClass, JsonNullValues, JsonObject, JsonValue } from "./common-types.mjs";
2
+ import { a as CoreCreateOperations, c as CoreReadOperations, d as FilterPropertyToKind, f as LOGICAL_COMBINATORS, i as AllWriteOperations, l as CoreUpdateOperations, n as AllCrudOperations, o as CoreCrudOperations, p as TRANSACTION_UNSUPPORTED_METHODS, r as AllReadOperations, s as CoreDeleteOperations, t as AggregateOperators, u as CoreWriteOperations } from "./constants-RUWhnVl4.mjs";
2
3
  import * as _$kysely from "kysely";
3
4
  import { AddColumnNode, AddConstraintNode, AddIndexNode, AddValueNode, AggregateFunctionNode, AliasNode, AliasableExpression, AlterColumnNode, AlterTableNode, AlterTypeNode, AndNode, BinaryOperationNode, CaseNode, CastNode, CheckConstraintNode, CollateNode, ColumnDefinitionNode, ColumnNode, ColumnUpdateNode, CommonTableExpressionNameNode, CommonTableExpressionNode, CreateIndexNode, CreateSchemaNode, CreateTableNode, CreateTypeNode, CreateViewNode, DataTypeNode, DefaultInsertValueNode, DefaultValueNode, DeleteQueryNode, Dialect, DropColumnNode, DropConstraintNode, DropIndexNode, DropSchemaNode, DropTableNode, DropTypeNode, DropViewNode, ExplainNode, Expression, ExpressionBuilder, ExpressionWrapper, FetchNode, ForeignKeyConstraintNode, FromNode, FunctionNode, Generated, GeneratedNode, GroupByItemNode, GroupByNode, HavingNode, IdentifierNode, InsertQueryNode, JSONOperatorChainNode, JSONPathLegNode, JSONPathNode, JSONReferenceNode, JoinNode, Kysely, KyselyConfig, LimitNode, ListNode, MatchedNode, MergeQueryNode, ModifyColumnNode, OffsetNode, OnConflictNode, OnDuplicateKeyNode, OnNode, OperandExpression, OperationNode, OperationNodeVisitor, OperatorNode, OrActionNode, OrNode, OrderByItemNode, OrderByNode, OutputNode, OverNode, ParensNode, PartitionByItemNode, PartitionByNode, PrimaryKeyConstraintNode, PrimitiveValueListNode, QueryId, QueryResult, RawNode, ReferenceNode, ReferencesNode, RefreshMaterializedViewNode, RenameColumnNode, RenameConstraintNode, RenameValueNode, ReturningNode, RootOperationNode, SchemableIdentifierNode, SelectAllNode, SelectModifierNode, SelectQueryBuilder, SelectQueryNode, SelectionNode, SetOperationNode, SqlBool, TableNode, TopNode, TupleNode, UnaryOperationNode, UniqueConstraintNode, UnknownRow, UpdateQueryNode, UsingNode, ValueListNode, ValueNode, ValuesNode, WhenNode, WhereNode, WithNode } from "kysely";
4
- import { ZodType, z as z$1 } from "zod";
5
+ import { ZodType, z } from "zod";
5
6
  import * as _$_zenstackhq_schema0 from "@zenstackhq/schema";
6
7
  import { ArrayExpression, BinaryExpression, BindingExpression, BuiltinType, CallExpression, DataSourceProviderType, EnumDef, Expression as Expression$1, FieldDef, FieldExpression, FieldHasDefault, FieldIsArray, FieldIsDelegateDiscriminator, FieldIsRelation, FieldType, ForeignKeyFields, GetEnum, GetEnums, GetModel, GetModelDelegateMapValue, GetModelDiscriminator, GetModelField, GetModelFieldType, GetModelFields, GetModels, GetSubModels, GetTypeDefField, GetTypeDefFieldType, GetTypeDefFields, GetTypeDefs, IsDelegateModel, LiteralExpression, MemberExpression, ModelDef, ModelFieldIsOptional, NonRelationFields, NullExpression, ProcedureDef, RelationFieldType, RelationFields, RelationInfo, ScalarFields, SchemaDef, ThisExpression, TypeDefDef, TypeDefFieldIsArray, TypeDefFieldIsOptional, UnaryExpression, UpdatedAtInfo } from "@zenstackhq/schema";
7
8
  import Decimal from "decimal.js";
@@ -162,61 +163,6 @@ type _NoExtraObject<T extends object, Shape, Keys extends PropertyKey = _ObjectK
162
163
  */
163
164
  type NoExtraProperties<T, Shape> = unknown extends Shape ? unknown : T extends _ExactLeaf ? T : T extends readonly (infer Item)[] ? [_ArrayItem<Shape>] extends [never] ? never : NoExtraProperties<Item, _ArrayItem<Shape>>[] : T extends object ? _NoExtraObject<T, Shape> : T;
164
165
  //#endregion
165
- //#region src/client/constants.d.ts
166
- /**
167
- * Client API methods that are not supported in transactions.
168
- */
169
- declare const TRANSACTION_UNSUPPORTED_METHODS: readonly ["$transaction", "$connect", "$disconnect", "$use"];
170
- /**
171
- * Logical combinators used in filters.
172
- */
173
- declare const LOGICAL_COMBINATORS: readonly ["AND", "OR", "NOT"];
174
- /**
175
- * Aggregation operators.
176
- */
177
- declare const AggregateOperators: readonly ["_count", "_sum", "_avg", "_min", "_max"];
178
- type AggregateOperators = (typeof AggregateOperators)[number];
179
- /**
180
- * Mapping of filter operators to their corresponding filter kind categories.
181
- */
182
- declare const FILTER_PROPERTY_TO_KIND: {
183
- readonly equals: "Equality";
184
- readonly not: "Equality";
185
- readonly in: "Equality";
186
- readonly notIn: "Equality";
187
- readonly lt: "Range";
188
- readonly lte: "Range";
189
- readonly gt: "Range";
190
- readonly gte: "Range";
191
- readonly between: "Range";
192
- readonly contains: "Like";
193
- readonly startsWith: "Like";
194
- readonly endsWith: "Like";
195
- readonly mode: "Like";
196
- readonly is: "Relation";
197
- readonly isNot: "Relation";
198
- readonly some: "Relation";
199
- readonly every: "Relation";
200
- readonly none: "Relation";
201
- readonly path: "Json";
202
- readonly string_contains: "Json";
203
- readonly string_starts_with: "Json";
204
- readonly string_ends_with: "Json";
205
- readonly array_contains: "Json";
206
- readonly array_starts_with: "Json";
207
- readonly array_ends_with: "Json";
208
- readonly fuzzy: "Fuzzy";
209
- readonly fts: "FullText";
210
- readonly has: "List";
211
- readonly hasEvery: "List";
212
- readonly hasSome: "List";
213
- readonly isEmpty: "List";
214
- };
215
- /**
216
- * Mapping of filter operators to their corresponding filter kind categories.
217
- */
218
- type FilterPropertyToKind = typeof FILTER_PROPERTY_TO_KIND;
219
- //#endregion
220
166
  //#region src/client/query-builder.d.ts
221
167
  type ToKyselySchema<Schema extends SchemaDef> = { [Model in GetModels<Schema>]: ToKyselyTable<Schema, Model> };
222
168
  type ToKysely<Schema extends SchemaDef> = Kysely<ToKyselySchema<Schema>>;
@@ -1043,80 +989,6 @@ declare class InputValidator<Schema extends SchemaDef> {
1043
989
  private validate;
1044
990
  }
1045
991
  //#endregion
1046
- //#region src/client/crud/operations/base.d.ts
1047
- /**
1048
- * List of core CRUD operations. It excludes the 'orThrow' variants.
1049
- */
1050
- declare const CoreCrudOperations: readonly ["findMany", "findUnique", "findFirst", "create", "createMany", "createManyAndReturn", "update", "updateMany", "updateManyAndReturn", "upsert", "delete", "deleteMany", "count", "aggregate", "groupBy", "exists"];
1051
- /**
1052
- * List of core CRUD operations. It excludes the 'orThrow' variants.
1053
- */
1054
- type CoreCrudOperations = (typeof CoreCrudOperations)[number];
1055
- /**
1056
- * List of core read operations. It excludes the 'orThrow' variants.
1057
- */
1058
- declare const CoreReadOperations: readonly ["findMany", "findUnique", "findFirst", "count", "aggregate", "groupBy", "exists"];
1059
- /**
1060
- * List of core read operations. It excludes the 'orThrow' variants.
1061
- */
1062
- type CoreReadOperations = (typeof CoreReadOperations)[number];
1063
- /**
1064
- * List of core write operations.
1065
- */
1066
- declare const CoreWriteOperations: readonly ["create", "createMany", "createManyAndReturn", "update", "updateMany", "updateManyAndReturn", "upsert", "delete", "deleteMany"];
1067
- /**
1068
- * List of core write operations.
1069
- */
1070
- type CoreWriteOperations = (typeof CoreWriteOperations)[number];
1071
- /**
1072
- * List of core create operations.
1073
- */
1074
- declare const CoreCreateOperations: readonly ["create", "createMany", "createManyAndReturn", "upsert"];
1075
- /**
1076
- * List of core create operations.
1077
- */
1078
- type CoreCreateOperations = (typeof CoreCreateOperations)[number];
1079
- /**
1080
- * List of core update operations.
1081
- */
1082
- declare const CoreUpdateOperations: readonly ["update", "updateMany", "updateManyAndReturn", "upsert"];
1083
- /**
1084
- * List of core update operations.
1085
- */
1086
- type CoreUpdateOperations = (typeof CoreUpdateOperations)[number];
1087
- /**
1088
- * List of core delete operations.
1089
- */
1090
- declare const CoreDeleteOperations: readonly ["delete", "deleteMany"];
1091
- /**
1092
- * List of core delete operations.
1093
- */
1094
- type CoreDeleteOperations = (typeof CoreDeleteOperations)[number];
1095
- /**
1096
- * List of all CRUD operations, including 'orThrow' variants.
1097
- */
1098
- declare const AllCrudOperations: readonly ["findMany", "findUnique", "findFirst", "create", "createMany", "createManyAndReturn", "update", "updateMany", "updateManyAndReturn", "upsert", "delete", "deleteMany", "count", "aggregate", "groupBy", "exists", "findUniqueOrThrow", "findFirstOrThrow"];
1099
- /**
1100
- * List of all CRUD operations, including 'orThrow' variants.
1101
- */
1102
- type AllCrudOperations = (typeof AllCrudOperations)[number];
1103
- /**
1104
- * List of all read operations, including 'orThrow' variants.
1105
- */
1106
- declare const AllReadOperations: readonly ["findMany", "findUnique", "findFirst", "count", "aggregate", "groupBy", "exists", "findUniqueOrThrow", "findFirstOrThrow"];
1107
- /**
1108
- * List of all read operations, including 'orThrow' variants.
1109
- */
1110
- type AllReadOperations = (typeof AllReadOperations)[number];
1111
- /**
1112
- * List of all write operations - simply an alias of CoreWriteOperations.
1113
- */
1114
- declare const AllWriteOperations: readonly ["create", "createMany", "createManyAndReturn", "update", "updateMany", "updateManyAndReturn", "upsert", "delete", "deleteMany"];
1115
- /**
1116
- * List of all write operations - simply an alias of CoreWriteOperations.
1117
- */
1118
- type AllWriteOperations = CoreWriteOperations;
1119
- //#endregion
1120
992
  //#region src/client/type-utils.d.ts
1121
993
  /**
1122
994
  * Checks if a model has any required Unsupported fields (non-optional, no default).
@@ -3348,7 +3220,7 @@ declare class ZodSchemaFactory<in out Schema extends SchemaDef, in out Options e
3348
3220
  * before serialization.
3349
3221
  */
3350
3222
  toJSONSchema(): {
3351
- schemas: Record<string, z$1.core.JSONSchema.BaseSchema>;
3223
+ schemas: Record<string, z.core.JSONSchema.BaseSchema>;
3352
3224
  };
3353
3225
  get cacheStats(): {
3354
3226
  size: number;