@zenstackhq/orm 3.10.0 → 3.10.1
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.cjs +39 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -2
- package/dist/index.d.mts +9 -4
- package/dist/index.mjs +236 -205
- package/dist/index.mjs.map +1 -1
- package/package.json +8 -8
package/dist/index.d.cts
CHANGED
|
@@ -1006,17 +1006,22 @@ type FuzzyFilterOptions = {
|
|
|
1006
1006
|
};
|
|
1007
1007
|
//#endregion
|
|
1008
1008
|
//#region src/client/crud/validator/validator.d.ts
|
|
1009
|
-
type InputValidatorOptions = {
|
|
1009
|
+
type InputValidatorOptions<Schema extends SchemaDef> = {
|
|
1010
1010
|
/**
|
|
1011
1011
|
* Whether validation is enabled. Defaults to `true`.
|
|
1012
1012
|
*/
|
|
1013
1013
|
enabled?: boolean;
|
|
1014
|
+
/**
|
|
1015
|
+
* Schema factory to validate with. Defaults to a new factory (and so a new schema cache) bound
|
|
1016
|
+
* to the client.
|
|
1017
|
+
*/
|
|
1018
|
+
zodFactory?: ZodSchemaFactory<Schema>;
|
|
1014
1019
|
};
|
|
1015
1020
|
declare class InputValidator<Schema extends SchemaDef> {
|
|
1016
1021
|
private readonly client;
|
|
1017
1022
|
readonly zodFactory: ZodSchemaFactory<Schema>;
|
|
1018
1023
|
private readonly enabled;
|
|
1019
|
-
constructor(client: ClientContract<Schema>, options?: InputValidatorOptions);
|
|
1024
|
+
constructor(client: ClientContract<Schema>, options?: InputValidatorOptions<Schema>);
|
|
1020
1025
|
validateFindArgs(model: GetModels<Schema>, args: unknown, operation: 'findFirst' | 'findUnique' | 'findMany'): FindArgs<Schema, GetModels<Schema>, any, true> | undefined;
|
|
1021
1026
|
validateExistsArgs(model: GetModels<Schema>, args: unknown): ExistsArgs<Schema, GetModels<Schema>, any> | undefined;
|
|
1022
1027
|
validateCreateArgs(model: GetModels<Schema>, args: unknown): CreateArgs<Schema, GetModels<Schema>, any>;
|
package/dist/index.d.mts
CHANGED
|
@@ -2,7 +2,7 @@ import { AnyNull, AnyNullClass, DbNull, DbNullClass, JsonArray, JsonNull, JsonNu
|
|
|
2
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";
|
|
3
3
|
import * as _$kysely from "kysely";
|
|
4
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, Selectable, SelectionNode, SetOperationNode, SqlBool, TableNode, TopNode, TupleNode, UnaryOperationNode, UniqueConstraintNode, UnknownRow, UpdateQueryNode, UsingNode, ValueListNode, ValueNode, ValuesNode, WhenNode, WhereNode, WithNode } from "kysely";
|
|
5
|
-
import { ZodType, z } from "zod";
|
|
5
|
+
import { ZodType, z as z$1 } from "zod";
|
|
6
6
|
import * as _$_zenstackhq_schema0 from "@zenstackhq/schema";
|
|
7
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, GetTypeDef, GetTypeDefField, GetTypeDefFieldType, GetTypeDefFields, GetTypeDefs, IsDelegateModel, LiteralExpression, MemberExpression, ModelDef, ModelFieldIsOptional, NonRelationFields, NullExpression, ProcedureDef, RelationFieldType, RelationFields, RelationInfo, ScalarFields, SchemaDef, ThisExpression, TypeDefDef, TypeDefFieldIsArray, TypeDefFieldIsOptional, TypeDefIsPrimitive, UnaryExpression, UpdatedAtInfo } from "@zenstackhq/schema";
|
|
8
8
|
import Decimal from "decimal.js";
|
|
@@ -1006,17 +1006,22 @@ type FuzzyFilterOptions = {
|
|
|
1006
1006
|
};
|
|
1007
1007
|
//#endregion
|
|
1008
1008
|
//#region src/client/crud/validator/validator.d.ts
|
|
1009
|
-
type InputValidatorOptions = {
|
|
1009
|
+
type InputValidatorOptions<Schema extends SchemaDef> = {
|
|
1010
1010
|
/**
|
|
1011
1011
|
* Whether validation is enabled. Defaults to `true`.
|
|
1012
1012
|
*/
|
|
1013
1013
|
enabled?: boolean;
|
|
1014
|
+
/**
|
|
1015
|
+
* Schema factory to validate with. Defaults to a new factory (and so a new schema cache) bound
|
|
1016
|
+
* to the client.
|
|
1017
|
+
*/
|
|
1018
|
+
zodFactory?: ZodSchemaFactory<Schema>;
|
|
1014
1019
|
};
|
|
1015
1020
|
declare class InputValidator<Schema extends SchemaDef> {
|
|
1016
1021
|
private readonly client;
|
|
1017
1022
|
readonly zodFactory: ZodSchemaFactory<Schema>;
|
|
1018
1023
|
private readonly enabled;
|
|
1019
|
-
constructor(client: ClientContract<Schema>, options?: InputValidatorOptions);
|
|
1024
|
+
constructor(client: ClientContract<Schema>, options?: InputValidatorOptions<Schema>);
|
|
1020
1025
|
validateFindArgs(model: GetModels<Schema>, args: unknown, operation: 'findFirst' | 'findUnique' | 'findMany'): FindArgs<Schema, GetModels<Schema>, any, true> | undefined;
|
|
1021
1026
|
validateExistsArgs(model: GetModels<Schema>, args: unknown): ExistsArgs<Schema, GetModels<Schema>, any> | undefined;
|
|
1022
1027
|
validateCreateArgs(model: GetModels<Schema>, args: unknown): CreateArgs<Schema, GetModels<Schema>, any>;
|
|
@@ -3280,7 +3285,7 @@ declare class ZodSchemaFactory<in out Schema extends SchemaDef, in out Options e
|
|
|
3280
3285
|
* before serialization.
|
|
3281
3286
|
*/
|
|
3282
3287
|
toJSONSchema(): {
|
|
3283
|
-
schemas: Record<string, z.core.JSONSchema.BaseSchema>;
|
|
3288
|
+
schemas: Record<string, z$1.core.JSONSchema.BaseSchema>;
|
|
3284
3289
|
};
|
|
3285
3290
|
get cacheStats(): {
|
|
3286
3291
|
size: number;
|