@zenstackhq/runtime 3.0.0-beta.7 → 3.0.0-beta.9

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.
@@ -1,6 +1,6 @@
1
- import Decimal, { Decimal as Decimal$1 } from 'decimal.js';
2
- import { SchemaDef, GetModels, ScalarFields, ForeignKeyFields, GetModelFields, FieldHasDefault, GetModelFieldType, ModelFieldIsOptional, GetModelField, NonRelationFields, RelationFields, FieldIsArray, RelationFieldType, FieldIsRelation, GetModel, FieldDef, GetEnums, GetEnum, GetTypeDefs, GetTypeDefFields, GetTypeDefField, TypeDefFieldIsOptional, BuiltinType, IsDelegateModel, GetModelDiscriminator, GetSubModels, FieldIsDelegateDiscriminator, FieldType, RelationInfo, FieldIsDelegateRelation, ModelDef, DataSourceProviderType, ProcedureDef } from '@zenstackhq/sdk/schema';
3
- import { Generated, Kysely, ExpressionBuilder, OperandExpression, SqlBool, SelectQueryBuilder, Expression, ExpressionWrapper, OperationNode, RootOperationNode, QueryResult, UnknownRow, Dialect, KyselyConfig } from 'kysely';
1
+ import { SchemaDef, GetModels, ScalarFields, ForeignKeyFields, GetModelFields, FieldHasDefault, GetModelFieldType, ModelFieldIsOptional, GetModelField, NonRelationFields, RelationFields, FieldIsArray, RelationFieldType, FieldIsRelation, GetModel, FieldDef, GetEnums, GetEnum, GetTypeDefs, GetTypeDefFields, GetTypeDefField, TypeDefFieldIsOptional, BuiltinType, IsDelegateModel, GetModelDiscriminator, GetSubModels, FieldIsDelegateDiscriminator, FieldType, RelationInfo, FieldIsDelegateRelation } from '@zenstackhq/sdk/schema';
2
+ import { Generated, Kysely, ExpressionBuilder, OperandExpression, SqlBool } from 'kysely';
3
+ import Decimal from 'decimal.js';
4
4
 
5
5
  type Optional<T extends object, K extends keyof T = keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
6
6
  type NullableIf<T, Condition extends boolean> = Condition extends true ? T | null : T;
@@ -56,8 +56,8 @@ type ToKyselyTable<Schema extends SchemaDef, Model extends GetModels<Schema>> =
56
56
  };
57
57
  type MapBaseType<T> = T extends 'String' ? string : T extends 'Boolean' ? boolean : T extends 'Int' | 'Float' ? number : T extends 'BigInt' ? bigint : T extends 'Decimal' ? Decimal : T extends 'DateTime' ? string : unknown;
58
58
  type WrapNull<T, Null> = Null extends true ? T | null : T;
59
- type MapType$1<Schema extends SchemaDef, Model extends GetModels<Schema>, Field extends GetModelFields<Schema, Model>> = WrapNull<MapBaseType<GetModelFieldType<Schema, Model, Field>>, ModelFieldIsOptional<Schema, Model, Field>>;
60
- type toKyselyFieldType<Schema extends SchemaDef, Model extends GetModels<Schema>, Field extends GetModelFields<Schema, Model>> = FieldHasDefault<Schema, Model, Field> extends true ? Generated<MapType$1<Schema, Model, Field>> : MapType$1<Schema, Model, Field>;
59
+ type MapType<Schema extends SchemaDef, Model extends GetModels<Schema>, Field extends GetModelFields<Schema, Model>> = WrapNull<MapBaseType<GetModelFieldType<Schema, Model, Field>>, ModelFieldIsOptional<Schema, Model, Field>>;
60
+ type toKyselyFieldType<Schema extends SchemaDef, Model extends GetModels<Schema>, Field extends GetModelFields<Schema, Model>> = FieldHasDefault<Schema, Model, Field> extends true ? Generated<MapType<Schema, Model, Field>> : MapType<Schema, Model, Field>;
61
61
 
62
62
  type DefaultModelResult<Schema extends SchemaDef, Model extends GetModels<Schema>, Omit = undefined, Optional = false, Array = false> = WrapType<IsDelegateModel<Schema, Model> extends true ? DelegateUnionResult<Schema, Model, GetSubModels<Schema, Model>, Omit> : {
63
63
  [Key in NonRelationFields<Schema, Model> as Key extends keyof Omit ? Omit[Key] extends true ? never : Key : Key]: MapModelFieldType<Schema, Model, Key>;
@@ -521,988 +521,4 @@ type ProviderSupportsDistinct<Schema extends SchemaDef> = Schema['provider']['ty
521
521
 
522
522
  type AuthType<Schema extends SchemaDef> = string extends GetModels<Schema> ? Record<string, unknown> : Schema['authType'] extends GetModels<Schema> ? Partial<ModelResult<Schema, Schema['authType']>> : never;
523
523
 
524
- /**
525
- * Client API methods that are not supported in transactions.
526
- */
527
- declare const TRANSACTION_UNSUPPORTED_METHODS: readonly ["$transaction", "$disconnect", "$use"];
528
- /**
529
- * Logical combinators used in filters.
530
- */
531
- declare const LOGICAL_COMBINATORS: readonly ["AND", "OR", "NOT"];
532
-
533
- declare abstract class BaseCrudDialect<Schema extends SchemaDef> {
534
- protected readonly schema: Schema;
535
- protected readonly options: ClientOptions<Schema>;
536
- constructor(schema: Schema, options: ClientOptions<Schema>);
537
- transformPrimitive(value: unknown, _type: BuiltinType, _forArrayField: boolean): unknown;
538
- transformOutput(value: unknown, _type: BuiltinType): unknown;
539
- buildSelectModel(eb: ExpressionBuilder<any, any>, model: string, modelAlias: string): SelectQueryBuilder<any, any, {}>;
540
- buildFilterSortTake(model: GetModels<Schema>, args: FindArgs<Schema, GetModels<Schema>, true>, query: SelectQueryBuilder<any, any, {}>, modelAlias: string): SelectQueryBuilder<any, any, {}>;
541
- buildFilter(eb: ExpressionBuilder<any, any>, model: string, modelAlias: string, where: boolean | object | undefined): Expression<SqlBool>;
542
- private buildCursorFilter;
543
- private isLogicalCombinator;
544
- protected buildCompositeFilter(eb: ExpressionBuilder<any, any>, model: string, modelAlias: string, key: (typeof LOGICAL_COMBINATORS)[number], payload: any): Expression<SqlBool>;
545
- private buildRelationFilter;
546
- private buildToOneRelationFilter;
547
- private buildToManyRelationFilter;
548
- private buildArrayFilter;
549
- buildPrimitiveFilter(eb: ExpressionBuilder<any, any>, fieldRef: Expression<any>, fieldDef: FieldDef, payload: any): Expression<SqlBool>;
550
- private buildLiteralFilter;
551
- private buildStandardFilter;
552
- private buildStringFilter;
553
- private prepStringCasing;
554
- private buildNumberFilter;
555
- private buildBooleanFilter;
556
- private buildDateTimeFilter;
557
- private buildBytesFilter;
558
- private buildEnumFilter;
559
- buildOrderBy(query: SelectQueryBuilder<any, any, any>, model: string, modelAlias: string, orderBy: OrArray<OrderBy<Schema, GetModels<Schema>, boolean, boolean>> | undefined, useDefaultIfEmpty: boolean, negated: boolean): SelectQueryBuilder<any, any, any>;
560
- buildSelectAllFields(model: string, query: SelectQueryBuilder<any, any, any>, omit: Record<string, boolean | undefined> | undefined, modelAlias: string): SelectQueryBuilder<any, any, any>;
561
- protected buildModelSelect(eb: ExpressionBuilder<any, any>, model: GetModels<Schema>, subQueryAlias: string, payload: true | FindArgs<Schema, GetModels<Schema>, true>, selectAllFields: boolean): SelectQueryBuilder<any, any, {}>;
562
- buildSelectField(query: SelectQueryBuilder<any, any, any>, model: string, modelAlias: string, field: string): SelectQueryBuilder<any, any, any>;
563
- buildDelegateJoin(thisModel: string, thisModelAlias: string, otherModelAlias: string, query: SelectQueryBuilder<any, any, any>): SelectQueryBuilder<any, any, any>;
564
- buildCountJson(model: string, eb: ExpressionBuilder<any, any>, parentAlias: string, payload: any): ExpressionWrapper<any, any, unknown>;
565
- private negateSort;
566
- true(eb: ExpressionBuilder<any, any>): Expression<SqlBool>;
567
- false(eb: ExpressionBuilder<any, any>): Expression<SqlBool>;
568
- isTrue(expression: Expression<SqlBool>): boolean;
569
- isFalse(expression: Expression<SqlBool>): boolean;
570
- and(eb: ExpressionBuilder<any, any>, ...args: Expression<SqlBool>[]): Expression<SqlBool>;
571
- or(eb: ExpressionBuilder<any, any>, ...args: Expression<SqlBool>[]): Expression<SqlBool>;
572
- not(eb: ExpressionBuilder<any, any>, ...args: Expression<SqlBool>[]): ExpressionWrapper<any, any, SqlBool>;
573
- fieldRef(model: string, field: string, eb: ExpressionBuilder<any, any>, modelAlias?: string, inlineComputedField?: boolean): ExpressionWrapper<any, any, unknown>;
574
- protected canJoinWithoutNestedSelect(modelDef: ModelDef, payload: boolean | FindArgs<Schema, GetModels<Schema>, true>): boolean;
575
- abstract get provider(): DataSourceProviderType;
576
- /**
577
- * Builds selection for a relation field.
578
- */
579
- abstract buildRelationSelection(query: SelectQueryBuilder<any, any, any>, model: string, relationField: string, parentAlias: string, payload: true | FindArgs<Schema, GetModels<Schema>, true>): SelectQueryBuilder<any, any, any>;
580
- /**
581
- * Builds skip and take clauses.
582
- */
583
- abstract buildSkipTake(query: SelectQueryBuilder<any, any, any>, skip: number | undefined, take: number | undefined): SelectQueryBuilder<any, any, any>;
584
- /**
585
- * Builds an Kysely expression that returns a JSON object for the given key-value pairs.
586
- */
587
- abstract buildJsonObject(eb: ExpressionBuilder<any, any>, value: Record<string, Expression<unknown>>): ExpressionWrapper<any, any, unknown>;
588
- /**
589
- * Builds an Kysely expression that returns the length of an array.
590
- */
591
- abstract buildArrayLength(eb: ExpressionBuilder<any, any>, array: Expression<unknown>): ExpressionWrapper<any, any, number>;
592
- /**
593
- * Builds an array literal SQL string for the given values.
594
- */
595
- abstract buildArrayLiteralSQL(values: unknown[]): string;
596
- /**
597
- * Whether the dialect supports updating with a limit on the number of updated rows.
598
- */
599
- abstract get supportsUpdateWithLimit(): boolean;
600
- /**
601
- * Whether the dialect supports deleting with a limit on the number of deleted rows.
602
- */
603
- abstract get supportsDeleteWithLimit(): boolean;
604
- /**
605
- * Whether the dialect supports DISTINCT ON.
606
- */
607
- abstract get supportsDistinctOn(): boolean;
608
- /**
609
- * Whether the dialect support inserting with `DEFAULT` as field value.
610
- */
611
- abstract get supportInsertWithDefault(): boolean;
612
- /**
613
- * Gets the SQL column type for the given field definition.
614
- */
615
- abstract getFieldSqlType(fieldDef: FieldDef): string;
616
- abstract getStringCasingBehavior(): {
617
- supportsILike: boolean;
618
- likeCaseSensitive: boolean;
619
- };
620
- }
621
-
622
- type CoreCrudOperation = 'findMany' | 'findUnique' | 'findFirst' | 'create' | 'createMany' | 'createManyAndReturn' | 'update' | 'updateMany' | 'updateManyAndReturn' | 'upsert' | 'delete' | 'deleteMany' | 'count' | 'aggregate' | 'groupBy';
623
- type AllCrudOperation = CoreCrudOperation | 'findUniqueOrThrow' | 'findFirstOrThrow';
624
-
625
- /**
626
- * ZenStack runtime plugin.
627
- */
628
- interface RuntimePlugin<Schema extends SchemaDef = SchemaDef> {
629
- /**
630
- * Plugin ID.
631
- */
632
- id: string;
633
- /**
634
- * Plugin display name.
635
- */
636
- name?: string;
637
- /**
638
- * Plugin description.
639
- */
640
- description?: string;
641
- /**
642
- * Custom function implementations.
643
- */
644
- functions?: Record<string, ZModelFunction<Schema>>;
645
- /**
646
- * Intercepts an ORM query.
647
- */
648
- onQuery?: OnQueryCallback<Schema>;
649
- /**
650
- * Intercepts an entity mutation.
651
- */
652
- onEntityMutation?: EntityMutationHooksDef<Schema>;
653
- /**
654
- * Intercepts a Kysely query.
655
- */
656
- onKyselyQuery?: OnKyselyQueryCallback<Schema>;
657
- }
658
- /**
659
- * Defines a ZenStack runtime plugin.
660
- */
661
- declare function definePlugin<Schema extends SchemaDef>(plugin: RuntimePlugin<Schema>): RuntimePlugin<Schema>;
662
-
663
- type OnQueryCallback<Schema extends SchemaDef> = (ctx: OnQueryHookContext<Schema>) => Promise<unknown>;
664
- type OnQueryHookContext<Schema extends SchemaDef> = {
665
- /**
666
- * The model that is being queried.
667
- */
668
- model: GetModels<Schema>;
669
- /**
670
- * The operation that is being performed.
671
- */
672
- operation: AllCrudOperation;
673
- /**
674
- * The query arguments.
675
- */
676
- args: unknown;
677
- /**
678
- * The function to proceed with the original query.
679
- * It takes the same arguments as the operation method.
680
- *
681
- * @param args The query arguments.
682
- */
683
- proceed: (args: unknown) => Promise<unknown>;
684
- /**
685
- * The ZenStack client that is performing the operation.
686
- */
687
- client: ClientContract<Schema>;
688
- };
689
- type EntityMutationHooksDef<Schema extends SchemaDef> = {
690
- /**
691
- * Called before entities are mutated.
692
- */
693
- beforeEntityMutation?: BeforeEntityMutationCallback<Schema>;
694
- /**
695
- * Called after entities are mutated.
696
- */
697
- afterEntityMutation?: AfterEntityMutationCallback<Schema>;
698
- /**
699
- * Whether to run after-mutation hooks within the transaction that performs the mutation.
700
- *
701
- * If set to `true`, if the mutation already runs inside a transaction, the callbacks are
702
- * executed immediately after the mutation within the transaction boundary. If the mutation
703
- * is not running inside a transaction, a new transaction is created to run both the mutation
704
- * and the callbacks.
705
- *
706
- * If set to `false`, the callbacks are executed after the mutation transaction is committed.
707
- *
708
- * Defaults to `false`.
709
- */
710
- runAfterMutationWithinTransaction?: boolean;
711
- };
712
- type MutationHooksArgs<Schema extends SchemaDef> = {
713
- /**
714
- * The model that is being mutated.
715
- */
716
- model: GetModels<Schema>;
717
- /**
718
- * The mutation action that is being performed.
719
- */
720
- action: 'create' | 'update' | 'delete';
721
- /**
722
- * The mutation data. Only available for create and update actions.
723
- */
724
- queryNode: OperationNode;
725
- /**
726
- * A query ID that uniquely identifies the mutation operation. You can use it to correlate
727
- * data between the before and after mutation hooks.
728
- */
729
- queryId: string;
730
- };
731
- type BeforeEntityMutationCallback<Schema extends SchemaDef> = (args: PluginBeforeEntityMutationArgs<Schema>) => MaybePromise<void>;
732
- type AfterEntityMutationCallback<Schema extends SchemaDef> = (args: PluginAfterEntityMutationArgs<Schema>) => MaybePromise<void>;
733
- type PluginBeforeEntityMutationArgs<Schema extends SchemaDef> = MutationHooksArgs<Schema> & {
734
- /**
735
- * Loads the entities that are about to be mutated. The db operation that loads the entities is executed
736
- * within the same transaction context as the mutation.
737
- */
738
- loadBeforeMutationEntities(): Promise<Record<string, unknown>[] | undefined>;
739
- /**
740
- * The ZenStack client you can use to perform additional operations. The database operations initiated
741
- * from this client are executed within the same transaction as the mutation if the mutation is running
742
- * inside a transaction.
743
- *
744
- * Mutations initiated from this client will NOT trigger entity mutation hooks to avoid infinite loops.
745
- */
746
- client: ClientContract<Schema>;
747
- };
748
- type PluginAfterEntityMutationArgs<Schema extends SchemaDef> = MutationHooksArgs<Schema> & {
749
- /**
750
- * Loads the entities that have been mutated.
751
- */
752
- loadAfterMutationEntities(): Promise<Record<string, unknown>[] | undefined>;
753
- /**
754
- * The ZenStack client you can use to perform additional operations.
755
- * See {@link EntityMutationHooksDef.runAfterMutationWithinTransaction} for detailed transaction behavior.
756
- *
757
- * Mutations initiated from this client will NOT trigger entity mutation hooks to avoid infinite loops.
758
- */
759
- client: ClientContract<Schema>;
760
- };
761
- type OnKyselyQueryArgs<Schema extends SchemaDef> = {
762
- schema: SchemaDef;
763
- client: ClientContract<Schema>;
764
- query: RootOperationNode;
765
- proceed: ProceedKyselyQueryFunction;
766
- };
767
- type ProceedKyselyQueryFunction = (query: RootOperationNode) => Promise<QueryResult<any>>;
768
- type OnKyselyQueryCallback<Schema extends SchemaDef> = (args: OnKyselyQueryArgs<Schema>) => Promise<QueryResult<UnknownRow>>;
769
-
770
- type ZModelFunctionContext<Schema extends SchemaDef> = {
771
- /**
772
- * ZenStack client instance
773
- */
774
- client: ClientContract<Schema>;
775
- /**
776
- * Database dialect
777
- */
778
- dialect: BaseCrudDialect<Schema>;
779
- /**
780
- * The containing model name
781
- */
782
- model: GetModels<Schema>;
783
- /**
784
- * The alias name that can be used to refer to the containing model
785
- */
786
- modelAlias: string;
787
- /**
788
- * The CRUD operation being performed
789
- */
790
- operation: CRUD;
791
- };
792
- type ZModelFunction<Schema extends SchemaDef> = (eb: ExpressionBuilder<ToKyselySchema<Schema>, keyof ToKyselySchema<Schema>>, args: Expression<any>[], context: ZModelFunctionContext<Schema>) => Expression<unknown>;
793
- /**
794
- * ZenStack client options.
795
- */
796
- type ClientOptions<Schema extends SchemaDef> = {
797
- /**
798
- * Kysely dialect.
799
- */
800
- dialect: Dialect;
801
- /**
802
- * Custom function definitions.
803
- */
804
- functions?: Record<string, ZModelFunction<Schema>>;
805
- /**
806
- * Plugins.
807
- */
808
- plugins?: RuntimePlugin<Schema>[];
809
- /**
810
- * Logging configuration.
811
- */
812
- log?: KyselyConfig['log'];
813
- /**
814
- * Whether to automatically fix timezone for `DateTime` fields returned by node-pg. Defaults
815
- * to `true`.
816
- *
817
- * Node-pg has a terrible quirk that it interprets the date value as local timezone (as a
818
- * `Date` object) although for `DateTime` field the data in DB is stored in UTC.
819
- * @see https://github.com/brianc/node-postgres/issues/429
820
- */
821
- fixPostgresTimezone?: boolean;
822
- } & (HasComputedFields<Schema> extends true ? {
823
- /**
824
- * Computed field definitions.
825
- */
826
- computedFields: ComputedFieldsOptions<Schema>;
827
- } : {}) & (HasProcedures<Schema> extends true ? {
828
- /**
829
- * Custom procedure definitions.
830
- */
831
- procedures: ProceduresOptions<Schema>;
832
- } : {});
833
- type ComputedFieldsOptions<Schema extends SchemaDef> = {
834
- [Model in GetModels<Schema> as 'computedFields' extends keyof GetModel<Schema, Model> ? Model : never]: {
835
- [Field in keyof Schema['models'][Model]['computedFields']]: PrependParameter<ExpressionBuilder<ToKyselySchema<Schema>, Model>, Schema['models'][Model]['computedFields'][Field]>;
836
- };
837
- };
838
- type HasComputedFields<Schema extends SchemaDef> = string extends GetModels<Schema> ? false : keyof ComputedFieldsOptions<Schema> extends never ? false : true;
839
- type ProceduresOptions<Schema extends SchemaDef> = Schema extends {
840
- procedures: Record<string, ProcedureDef>;
841
- } ? {
842
- [Key in keyof Schema['procedures']]: PrependParameter<ClientContract<Schema>, ProcedureFunc<Schema, Schema['procedures'][Key]>>;
843
- } : {};
844
- type HasProcedures<Schema extends SchemaDef> = Schema extends {
845
- procedures: Record<string, ProcedureDef>;
846
- } ? true : false;
847
-
848
- /**
849
- * A promise that only executes when it's awaited or .then() is called.
850
- */
851
- type ZenStackPromise<Schema extends SchemaDef, T> = Promise<T> & {
852
- /**
853
- * @private
854
- * Callable to get a plain promise.
855
- */
856
- cb: (txClient?: ClientContract<Schema>) => Promise<T>;
857
- };
858
-
859
- type TransactionUnsupportedMethods = (typeof TRANSACTION_UNSUPPORTED_METHODS)[number];
860
- /**
861
- * Transaction isolation levels.
862
- */
863
- declare enum TransactionIsolationLevel {
864
- ReadUncommitted = "read uncommitted",
865
- ReadCommitted = "read committed",
866
- RepeatableRead = "repeatable read",
867
- Serializable = "serializable",
868
- Snapshot = "snapshot"
869
- }
870
- /**
871
- * ZenStack client interface.
872
- */
873
- type ClientContract<Schema extends SchemaDef> = {
874
- readonly $schema: Schema;
875
- /**
876
- * The client options.
877
- */
878
- readonly $options: ClientOptions<Schema>;
879
- /**
880
- * Executes a prepared raw query and returns the number of affected rows.
881
- * @example
882
- * ```
883
- * const result = await db.$executeRaw`UPDATE User SET cool = ${true} WHERE email = ${'user@email.com'};`
884
- * ```
885
- */
886
- $executeRaw(query: TemplateStringsArray, ...values: any[]): ZenStackPromise<Schema, number>;
887
- /**
888
- * Executes a raw query and returns the number of affected rows.
889
- * This method is susceptible to SQL injections.
890
- * @example
891
- * ```
892
- * const result = await db.$executeRawUnsafe('UPDATE User SET cool = $1 WHERE email = $2 ;', true, 'user@email.com')
893
- * ```
894
- */
895
- $executeRawUnsafe(query: string, ...values: any[]): ZenStackPromise<Schema, number>;
896
- /**
897
- * Performs a prepared raw query and returns the `SELECT` data.
898
- * @example
899
- * ```
900
- * const result = await db.$queryRaw`SELECT * FROM User WHERE id = ${1} OR email = ${'user@email.com'};`
901
- * ```
902
- */
903
- $queryRaw<T = unknown>(query: TemplateStringsArray, ...values: any[]): ZenStackPromise<Schema, T>;
904
- /**
905
- * Performs a raw query and returns the `SELECT` data.
906
- * This method is susceptible to SQL injections.
907
- * @example
908
- * ```
909
- * const result = await db.$queryRawUnsafe('SELECT * FROM User WHERE id = $1 OR email = $2;', 1, 'user@email.com')
910
- * ```
911
- */
912
- $queryRawUnsafe<T = unknown>(query: string, ...values: any[]): ZenStackPromise<Schema, T>;
913
- /**
914
- * The current user identity.
915
- */
916
- get $auth(): AuthType<Schema> | undefined;
917
- /**
918
- * Sets the current user identity.
919
- */
920
- $setAuth(auth: AuthType<Schema> | undefined): ClientContract<Schema>;
921
- /**
922
- * The Kysely query builder instance.
923
- */
924
- readonly $qb: ToKysely<Schema>;
925
- /**
926
- * The raw Kysely query builder without any ZenStack enhancements.
927
- */
928
- readonly $qbRaw: ToKysely<any>;
929
- /**
930
- * Starts an interactive transaction.
931
- */
932
- $transaction<T>(callback: (tx: Omit<ClientContract<Schema>, TransactionUnsupportedMethods>) => Promise<T>, options?: {
933
- isolationLevel?: TransactionIsolationLevel;
934
- }): Promise<T>;
935
- /**
936
- * Starts a sequential transaction.
937
- */
938
- $transaction<P extends ZenStackPromise<Schema, any>[]>(arg: [...P], options?: {
939
- isolationLevel?: TransactionIsolationLevel;
940
- }): Promise<UnwrapTuplePromises<P>>;
941
- /**
942
- * Returns a new client with the specified plugin installed.
943
- */
944
- $use(plugin: RuntimePlugin<Schema>): ClientContract<Schema>;
945
- /**
946
- * Returns a new client with the specified plugin removed.
947
- */
948
- $unuse(pluginId: string): ClientContract<Schema>;
949
- /**
950
- * Returns a new client with all plugins removed.
951
- */
952
- $unuseAll(): ClientContract<Schema>;
953
- /**
954
- * Disconnects the underlying Kysely instance from the database.
955
- */
956
- $disconnect(): Promise<void>;
957
- /**
958
- * Pushes the schema to the database. For testing purposes only.
959
- * @private
960
- */
961
- $pushSchema(): Promise<void>;
962
- } & {
963
- [Key in GetModels<Schema> as Uncapitalize<Key>]: ModelOperations<Schema, Key>;
964
- } & Procedures<Schema>;
965
- type _TypeMap = {
966
- String: string;
967
- Int: number;
968
- Float: number;
969
- BigInt: bigint;
970
- Decimal: Decimal$1;
971
- Boolean: boolean;
972
- DateTime: Date;
973
- };
974
- type MapType<Schema extends SchemaDef, T extends string> = T extends keyof _TypeMap ? _TypeMap[T] : T extends GetModels<Schema> ? ModelResult<Schema, T> : unknown;
975
- type Procedures<Schema extends SchemaDef> = Schema['procedures'] extends Record<string, ProcedureDef> ? {
976
- $procedures: {
977
- [Key in keyof Schema['procedures']]: ProcedureFunc<Schema, Schema['procedures'][Key]>;
978
- };
979
- } : {};
980
- type ProcedureFunc<Schema extends SchemaDef, Proc extends ProcedureDef> = (...args: MapProcedureParams<Schema, Proc['params']>) => Promise<MapType<Schema, Proc['returnType']>>;
981
- type MapProcedureParams<Schema extends SchemaDef, Params> = {
982
- [P in keyof Params]: Params[P] extends {
983
- type: infer U;
984
- } ? OrUndefinedIf<MapType<Schema, U & string>, Params[P] extends {
985
- optional: true;
986
- } ? true : false> : never;
987
- };
988
- /**
989
- * Creates a new ZenStack client instance.
990
- */
991
- interface ClientConstructor {
992
- new <Schema extends SchemaDef>(schema: Schema, options: ClientOptions<Schema>): ClientContract<Schema>;
993
- }
994
- /**
995
- * CRUD operations.
996
- */
997
- type CRUD = 'create' | 'read' | 'update' | 'delete';
998
- /**
999
- * CRUD operations.
1000
- */
1001
- declare const CRUD: readonly ["create", "read", "update", "delete"];
1002
- type AllModelOperations<Schema extends SchemaDef, Model extends GetModels<Schema>> = {
1003
- /**
1004
- * Returns a list of entities.
1005
- * @param args - query args
1006
- * @returns a list of entities
1007
- *
1008
- * @example
1009
- * ```ts
1010
- * // find all users and return all scalar fields
1011
- * await db.user.findMany();
1012
- *
1013
- * // find all users with name 'Alex'
1014
- * await db.user.findMany({
1015
- * where: {
1016
- * name: 'Alex'
1017
- * }
1018
- * });
1019
- *
1020
- * // select fields
1021
- * await db.user.findMany({
1022
- * select: {
1023
- * name: true,
1024
- * email: true,
1025
- * }
1026
- * }); // result: `Array<{ name: string, email: string }>`
1027
- *
1028
- * // omit fields
1029
- * await db.user.findMany({
1030
- * omit: {
1031
- * name: true,
1032
- * }
1033
- * }); // result: `Array<{ id: number; email: string; ... }>`
1034
- *
1035
- * // include relations (and all scalar fields)
1036
- * await db.user.findMany({
1037
- * include: {
1038
- * posts: true,
1039
- * }
1040
- * }); // result: `Array<{ ...; posts: Post[] }>`
1041
- *
1042
- * // include relations with filter
1043
- * await db.user.findMany({
1044
- * include: {
1045
- * posts: {
1046
- * where: {
1047
- * published: true
1048
- * }
1049
- * }
1050
- * }
1051
- * });
1052
- *
1053
- * // pagination and sorting
1054
- * await db.user.findMany({
1055
- * skip: 10,
1056
- * take: 10,
1057
- * orderBy: [{ name: 'asc' }, { email: 'desc' }],
1058
- * });
1059
- *
1060
- * // pagination with cursor (https://www.prisma.io/docs/orm/prisma-client/queries/pagination#cursor-based-pagination)
1061
- * await db.user.findMany({
1062
- * cursor: { id: 10 },
1063
- * skip: 1,
1064
- * take: 10,
1065
- * orderBy: { id: 'asc' },
1066
- * });
1067
- *
1068
- * // distinct
1069
- * await db.user.findMany({
1070
- * distinct: ['name']
1071
- * });
1072
- *
1073
- * // count all relations
1074
- * await db.user.findMany({
1075
- * _count: true,
1076
- * }); // result: `{ _count: { posts: number; ... } }`
1077
- *
1078
- * // count selected relations
1079
- * await db.user.findMany({
1080
- * _count: { select: { posts: true } },
1081
- * }); // result: `{ _count: { posts: number } }`
1082
- * ```
1083
- */
1084
- findMany<T extends FindArgs<Schema, Model, true>>(args?: SelectSubset<T, FindArgs<Schema, Model, true>>): ZenStackPromise<Schema, Simplify<ModelResult<Schema, Model, T>>[]>;
1085
- /**
1086
- * Returns a uniquely identified entity.
1087
- * @param args - query args
1088
- * @returns a single entity or null if not found
1089
- * @see {@link findMany}
1090
- */
1091
- findUnique<T extends FindUniqueArgs<Schema, Model>>(args: SelectSubset<T, FindUniqueArgs<Schema, Model>>): ZenStackPromise<Schema, Simplify<ModelResult<Schema, Model, T>> | null>;
1092
- /**
1093
- * Returns a uniquely identified entity or throws `NotFoundError` if not found.
1094
- * @param args - query args
1095
- * @returns a single entity
1096
- * @see {@link findMany}
1097
- */
1098
- findUniqueOrThrow<T extends FindUniqueArgs<Schema, Model>>(args: SelectSubset<T, FindUniqueArgs<Schema, Model>>): ZenStackPromise<Schema, Simplify<ModelResult<Schema, Model, T>>>;
1099
- /**
1100
- * Returns the first entity.
1101
- * @param args - query args
1102
- * @returns a single entity or null if not found
1103
- * @see {@link findMany}
1104
- */
1105
- findFirst<T extends FindArgs<Schema, Model, true>>(args?: SelectSubset<T, FindArgs<Schema, Model, true>>): ZenStackPromise<Schema, Simplify<ModelResult<Schema, Model, T>> | null>;
1106
- /**
1107
- * Returns the first entity or throws `NotFoundError` if not found.
1108
- * @param args - query args
1109
- * @returns a single entity
1110
- * @see {@link findMany}
1111
- */
1112
- findFirstOrThrow<T extends FindArgs<Schema, Model, true>>(args?: SelectSubset<T, FindArgs<Schema, Model, true>>): ZenStackPromise<Schema, Simplify<ModelResult<Schema, Model, T>>>;
1113
- /**
1114
- * Creates a new entity.
1115
- * @param args - create args
1116
- * @returns the created entity
1117
- *
1118
- * @example
1119
- * ```ts
1120
- * // simple create
1121
- * await db.user.create({
1122
- * data: { name: 'Alex', email: 'alex@zenstack.dev' }
1123
- * });
1124
- *
1125
- * // nested create with relation
1126
- * await db.user.create({
1127
- * data: {
1128
- * email: 'alex@zenstack.dev',
1129
- * posts: { create: { title: 'Hello World' } }
1130
- * }
1131
- * });
1132
- *
1133
- * // you can use `select`, `omit`, and `include` to control
1134
- * // the fields returned by the query, as with `findMany`
1135
- * await db.user.create({
1136
- * data: {
1137
- * email: 'alex@zenstack.dev',
1138
- * posts: { create: { title: 'Hello World' } }
1139
- * },
1140
- * include: { posts: true }
1141
- * }); // result: `{ id: number; posts: Post[] }`
1142
- *
1143
- * // connect relations
1144
- * await db.user.create({
1145
- * data: {
1146
- * email: 'alex@zenstack.dev',
1147
- * posts: { connect: { id: 1 } }
1148
- * }
1149
- * });
1150
- *
1151
- * // connect relations, and create if not found
1152
- * await db.user.create({
1153
- * data: {
1154
- * email: 'alex@zenstack.dev',
1155
- * posts: {
1156
- * connectOrCreate: {
1157
- * where: { id: 1 },
1158
- * create: { title: 'Hello World' }
1159
- * }
1160
- * }
1161
- * }
1162
- * });
1163
- * ```
1164
- */
1165
- create<T extends CreateArgs<Schema, Model>>(args: SelectSubset<T, CreateArgs<Schema, Model>>): ZenStackPromise<Schema, Simplify<ModelResult<Schema, Model, T>>>;
1166
- /**
1167
- * Creates multiple entities. Only scalar fields are allowed.
1168
- * @param args - create args
1169
- * @returns count of created entities: `{ count: number }`
1170
- *
1171
- * @example
1172
- * ```ts
1173
- * // create multiple entities
1174
- * await db.user.createMany({
1175
- * data: [
1176
- * { name: 'Alex', email: 'alex@zenstack.dev' },
1177
- * { name: 'John', email: 'john@zenstack.dev' }
1178
- * ]
1179
- * });
1180
- *
1181
- * // skip items that cause unique constraint violation
1182
- * await db.user.createMany({
1183
- * data: [
1184
- * { name: 'Alex', email: 'alex@zenstack.dev' },
1185
- * { name: 'John', email: 'john@zenstack.dev' }
1186
- * ],
1187
- * skipDuplicates: true
1188
- * });
1189
- * ```
1190
- */
1191
- createMany<T extends CreateManyArgs<Schema, Model>>(args?: SelectSubset<T, CreateManyArgs<Schema, Model>>): ZenStackPromise<Schema, BatchResult>;
1192
- /**
1193
- * Creates multiple entities and returns them.
1194
- * @param args - create args. See {@link createMany} for input. Use
1195
- * `select` and `omit` to control the fields returned.
1196
- * @returns the created entities
1197
- *
1198
- * @example
1199
- * ```ts
1200
- * // create multiple entities and return selected fields
1201
- * await db.user.createManyAndReturn({
1202
- * data: [
1203
- * { name: 'Alex', email: 'alex@zenstack.dev' },
1204
- * { name: 'John', email: 'john@zenstack.dev' }
1205
- * ],
1206
- * select: { id: true, email: true }
1207
- * });
1208
- * ```
1209
- */
1210
- createManyAndReturn<T extends CreateManyAndReturnArgs<Schema, Model>>(args?: SelectSubset<T, CreateManyAndReturnArgs<Schema, Model>>): ZenStackPromise<Schema, Simplify<ModelResult<Schema, Model, T>>[]>;
1211
- /**
1212
- * Updates a uniquely identified entity.
1213
- * @param args - update args. See {@link findMany} for how to control
1214
- * fields and relations returned.
1215
- * @returns the updated entity. Throws `NotFoundError` if the entity is not found.
1216
- *
1217
- * @example
1218
- * ```ts
1219
- * // update fields
1220
- * await db.user.update({
1221
- * where: { id: 1 },
1222
- * data: { name: 'Alex' }
1223
- * });
1224
- *
1225
- * // connect a relation
1226
- * await db.user.update({
1227
- * where: { id: 1 },
1228
- * data: { posts: { connect: { id: 1 } } }
1229
- * });
1230
- *
1231
- * // connect relation, and create if not found
1232
- * await db.user.update({
1233
- * where: { id: 1 },
1234
- * data: {
1235
- * posts: {
1236
- * connectOrCreate: {
1237
- * where: { id: 1 },
1238
- * create: { title: 'Hello World' }
1239
- * }
1240
- * }
1241
- * }
1242
- * });
1243
- *
1244
- * // create many related entities (only available for one-to-many relations)
1245
- * await db.user.update({
1246
- * where: { id: 1 },
1247
- * data: {
1248
- * posts: {
1249
- * createMany: {
1250
- * data: [{ title: 'Hello World' }, { title: 'Hello World 2' }],
1251
- * }
1252
- * }
1253
- * }
1254
- * });
1255
- *
1256
- * // disconnect a one-to-many relation
1257
- * await db.user.update({
1258
- * where: { id: 1 },
1259
- * data: { posts: { disconnect: { id: 1 } } }
1260
- * });
1261
- *
1262
- * // disconnect a one-to-one relation
1263
- * await db.user.update({
1264
- * where: { id: 1 },
1265
- * data: { profile: { disconnect: true } }
1266
- * });
1267
- *
1268
- * // replace a relation (only available for one-to-many relations)
1269
- * await db.user.update({
1270
- * where: { id: 1 },
1271
- * data: {
1272
- * posts: {
1273
- * set: [{ id: 1 }, { id: 2 }]
1274
- * }
1275
- * }
1276
- * });
1277
- *
1278
- * // update a relation
1279
- * await db.user.update({
1280
- * where: { id: 1 },
1281
- * data: {
1282
- * posts: {
1283
- * update: { where: { id: 1 }, data: { title: 'Hello World' } }
1284
- * }
1285
- * }
1286
- * });
1287
- *
1288
- * // upsert a relation
1289
- * await db.user.update({
1290
- * where: { id: 1 },
1291
- * data: {
1292
- * posts: {
1293
- * upsert: {
1294
- * where: { id: 1 },
1295
- * create: { title: 'Hello World' },
1296
- * update: { title: 'Hello World' }
1297
- * }
1298
- * }
1299
- * }
1300
- * });
1301
- *
1302
- * // update many related entities (only available for one-to-many relations)
1303
- * await db.user.update({
1304
- * where: { id: 1 },
1305
- * data: {
1306
- * posts: {
1307
- * updateMany: {
1308
- * where: { published: true },
1309
- * data: { title: 'Hello World' }
1310
- * }
1311
- * }
1312
- * }
1313
- * });
1314
- *
1315
- * // delete a one-to-many relation
1316
- * await db.user.update({
1317
- * where: { id: 1 },
1318
- * data: { posts: { delete: { id: 1 } } }
1319
- * });
1320
- *
1321
- * // delete a one-to-one relation
1322
- * await db.user.update({
1323
- * where: { id: 1 },
1324
- * data: { profile: { delete: true } }
1325
- * });
1326
- * ```
1327
- */
1328
- update<T extends UpdateArgs<Schema, Model>>(args: SelectSubset<T, UpdateArgs<Schema, Model>>): ZenStackPromise<Schema, Simplify<ModelResult<Schema, Model, T>>>;
1329
- /**
1330
- * Updates multiple entities.
1331
- * @param args - update args. Only scalar fields are allowed for data.
1332
- * @returns count of updated entities: `{ count: number }`
1333
- *
1334
- * @example
1335
- * ```ts
1336
- * // update many entities
1337
- * await db.user.updateMany({
1338
- * where: { email: { endsWith: '@zenstack.dev' } },
1339
- * data: { role: 'ADMIN' }
1340
- * });
1341
- *
1342
- * // limit the number of updated entities
1343
- * await db.user.updateMany({
1344
- * where: { email: { endsWith: '@zenstack.dev' } },
1345
- * data: { role: 'ADMIN' },
1346
- * limit: 10
1347
- * });
1348
- */
1349
- updateMany<T extends UpdateManyArgs<Schema, Model>>(args: Subset<T, UpdateManyArgs<Schema, Model>>): ZenStackPromise<Schema, BatchResult>;
1350
- /**
1351
- * Updates multiple entities and returns them.
1352
- * @param args - update args. Only scalar fields are allowed for data.
1353
- * @returns the updated entities
1354
- *
1355
- * @example
1356
- * ```ts
1357
- * // update many entities and return selected fields
1358
- * await db.user.updateManyAndReturn({
1359
- * where: { email: { endsWith: '@zenstack.dev' } },
1360
- * data: { role: 'ADMIN' },
1361
- * select: { id: true, email: true }
1362
- * }); // result: `Array<{ id: string; email: string }>`
1363
- *
1364
- * // limit the number of updated entities
1365
- * await db.user.updateManyAndReturn({
1366
- * where: { email: { endsWith: '@zenstack.dev' } },
1367
- * data: { role: 'ADMIN' },
1368
- * limit: 10
1369
- * });
1370
- * ```
1371
- */
1372
- updateManyAndReturn<T extends UpdateManyAndReturnArgs<Schema, Model>>(args: Subset<T, UpdateManyAndReturnArgs<Schema, Model>>): ZenStackPromise<Schema, Simplify<ModelResult<Schema, Model, T>>[]>;
1373
- /**
1374
- * Creates or updates an entity.
1375
- * @param args - upsert args
1376
- * @returns the upserted entity
1377
- *
1378
- * @example
1379
- * ```ts
1380
- * // upsert an entity
1381
- * await db.user.upsert({
1382
- * // `where` clause is used to find the entity
1383
- * where: { id: 1 },
1384
- * // `create` clause is used if the entity is not found
1385
- * create: { email: 'alex@zenstack.dev', name: 'Alex' },
1386
- * // `update` clause is used if the entity is found
1387
- * update: { name: 'Alex-new' },
1388
- * // `select` and `omit` can be used to control the returned fields
1389
- * ...
1390
- * });
1391
- * ```
1392
- */
1393
- upsert<T extends UpsertArgs<Schema, Model>>(args: SelectSubset<T, UpsertArgs<Schema, Model>>): ZenStackPromise<Schema, Simplify<ModelResult<Schema, Model, T>>>;
1394
- /**
1395
- * Deletes a uniquely identifiable entity.
1396
- * @param args - delete args
1397
- * @returns the deleted entity. Throws `NotFoundError` if the entity is not found.
1398
- *
1399
- * @example
1400
- * ```ts
1401
- * // delete an entity
1402
- * await db.user.delete({
1403
- * where: { id: 1 }
1404
- * });
1405
- *
1406
- * // delete an entity and return selected fields
1407
- * await db.user.delete({
1408
- * where: { id: 1 },
1409
- * select: { id: true, email: true }
1410
- * }); // result: `{ id: string; email: string }`
1411
- * ```
1412
- */
1413
- delete<T extends DeleteArgs<Schema, Model>>(args: SelectSubset<T, DeleteArgs<Schema, Model>>): ZenStackPromise<Schema, Simplify<ModelResult<Schema, Model, T>>>;
1414
- /**
1415
- * Deletes multiple entities.
1416
- * @param args - delete args
1417
- * @returns count of deleted entities: `{ count: number }`
1418
- *
1419
- * @example
1420
- * ```ts
1421
- * // delete many entities
1422
- * await db.user.deleteMany({
1423
- * where: { email: { endsWith: '@zenstack.dev' } }
1424
- * });
1425
- *
1426
- * // limit the number of deleted entities
1427
- * await db.user.deleteMany({
1428
- * where: { email: { endsWith: '@zenstack.dev' } },
1429
- * limit: 10
1430
- * });
1431
- * ```
1432
- */
1433
- deleteMany<T extends DeleteManyArgs<Schema, Model>>(args?: Subset<T, DeleteManyArgs<Schema, Model>>): ZenStackPromise<Schema, BatchResult>;
1434
- /**
1435
- * Counts rows or field values.
1436
- * @param args - count args
1437
- * @returns `number`, or an object containing count of selected relations
1438
- *
1439
- * @example
1440
- * ```ts
1441
- * // count all
1442
- * await db.user.count();
1443
- *
1444
- * // count with a filter
1445
- * await db.user.count({ where: { email: { endsWith: '@zenstack.dev' } } });
1446
- *
1447
- * // count rows and field values
1448
- * await db.user.count({
1449
- * select: { _all: true, email: true }
1450
- * }); // result: `{ _all: number, email: number }`
1451
- */
1452
- count<T extends CountArgs<Schema, Model>>(args?: Subset<T, CountArgs<Schema, Model>>): ZenStackPromise<Schema, Simplify<CountResult<Schema, Model, T>>>;
1453
- /**
1454
- * Aggregates rows.
1455
- * @param args - aggregation args
1456
- * @returns an object containing aggregated values
1457
- *
1458
- * @example
1459
- * ```ts
1460
- * // aggregate rows
1461
- * await db.profile.aggregate({
1462
- * where: { email: { endsWith: '@zenstack.dev' } },
1463
- * _count: true,
1464
- * _avg: { age: true },
1465
- * _sum: { age: true },
1466
- * _min: { age: true },
1467
- * _max: { age: true }
1468
- * }); // result: `{ _count: number, _avg: { age: number }, ... }`
1469
- */
1470
- aggregate<T extends AggregateArgs<Schema, Model>>(args: Subset<T, AggregateArgs<Schema, Model>>): ZenStackPromise<Schema, Simplify<AggregateResult<Schema, Model, T>>>;
1471
- /**
1472
- * Groups rows by columns.
1473
- * @param args - groupBy args
1474
- * @returns an object containing grouped values
1475
- *
1476
- * @example
1477
- * ```ts
1478
- * // group by a field
1479
- * await db.profile.groupBy({
1480
- * by: 'country',
1481
- * _count: true
1482
- * }); // result: `Array<{ country: string, _count: number }>`
1483
- *
1484
- * // group by multiple fields
1485
- * await db.profile.groupBy({
1486
- * by: ['country', 'city'],
1487
- * _count: true
1488
- * }); // result: `Array<{ country: string, city: string, _count: number }>`
1489
- *
1490
- * // group by with sorting, the `orderBy` fields must be either an aggregation
1491
- * // or a field used in the `by` list
1492
- * await db.profile.groupBy({
1493
- * by: 'country',
1494
- * orderBy: { country: 'desc' }
1495
- * });
1496
- *
1497
- * // group by with having (post-aggregation filter), the fields used in `having` must
1498
- * // be either an aggregation, or a field used in the `by` list
1499
- * await db.profile.groupBy({
1500
- * by: 'country',
1501
- * having: { country: 'US', age: { _avg: { gte: 18 } } }
1502
- * });
1503
- */
1504
- groupBy<T extends GroupByArgs<Schema, Model>>(args: Subset<T, GroupByArgs<Schema, Model>>): ZenStackPromise<Schema, Simplify<GroupByResult<Schema, Model, T>>>;
1505
- };
1506
- type ModelOperations<Schema extends SchemaDef, Model extends GetModels<Schema>> = Omit<AllModelOperations<Schema, Model>, IsDelegateModel<Schema, Model> extends true ? 'create' | 'createMany' | 'createManyAndReturn' | 'upsert' : never>;
1507
-
1508
- export { type DeleteArgs as A, type BatchResult as B, type ClientConstructor as C, type DateTimeFilter as D, type DeleteManyArgs as E, type FindArgs as F, type CountArgs as G, type CountResult as H, type IncludeInput as I, type JsonArray as J, type AggregateArgs as K, type AggregateResult as L, type ModelResult as M, type NumberFilter as N, type OrderBy as O, type GroupByArgs as P, type GroupByResult as Q, type RuntimePlugin as R, type SimplifiedModelResult as S, type ToKysely as T, type UpdateArgs as U, type ZModelFunction as V, type WhereInput as W, type OnKyselyQueryArgs as X, type ZenStackPromise as Z, type JsonObject as a, type JsonValue as b, type ClientContract as c, type ClientOptions as d, definePlugin as e, type TypeDefResult as f, type StringFilter as g, type BytesFilter as h, type BooleanFilter as i, type SortOrder as j, type NullsOrder as k, type WhereUniqueInput as l, type OmitInput as m, type SelectIncludeOmit as n, type SelectInput as o, type Subset as p, type SelectSubset as q, type FindManyArgs as r, type FindFirstArgs as s, type FindUniqueArgs as t, type CreateArgs as u, type CreateManyArgs as v, type CreateManyAndReturnArgs as w, type UpdateManyArgs as x, type UpdateManyAndReturnArgs as y, type UpsertArgs as z };
524
+ export type { AuthType as A, BatchResult as B, CreateArgs as C, DeleteArgs as D, BooleanFilter as E, FindArgs as F, GroupByArgs as G, SortOrder as H, NullsOrder as I, JsonArray as J, WhereUniqueInput as K, OmitInput as L, MaybePromise as M, NumberFilter as N, OrArray as O, PrependParameter as P, SelectIncludeOmit as Q, SelectInput as R, SelectSubset as S, ToKyselySchema as T, UnwrapTuplePromises as U, IncludeInput as V, WhereInput as W, FindManyArgs as X, FindFirstArgs as Y, OrderBy as a, ToKysely as b, Simplify as c, ModelResult as d, FindUniqueArgs as e, CreateManyArgs as f, CreateManyAndReturnArgs as g, UpdateArgs as h, UpdateManyArgs as i, Subset as j, UpdateManyAndReturnArgs as k, UpsertArgs as l, DeleteManyArgs as m, CountArgs as n, CountResult as o, AggregateArgs as p, AggregateResult as q, GroupByResult as r, OrUndefinedIf as s, JsonObject as t, JsonValue as u, SimplifiedModelResult as v, TypeDefResult as w, StringFilter as x, DateTimeFilter as y, BytesFilter as z };