@@ -19,7 +19,7 @@ import { ulid } from 'ulid';
1919import * as uuid from 'uuid' ;
2020import type { AnyKysely } from '../../../utils/kysely-utils' ;
2121import { extractFields , fieldsToSelectObject , isEmptyObject } from '../../../utils/object-utils' ;
22- import { NUMERIC_FIELD_TYPES } from '../../constants' ;
22+ import { NUMERIC_FIELD_TYPES , type CoreCrudOperations } from '../../constants' ;
2323import { TransactionIsolationLevel , type ClientContract , type CRUD } from '../../contract' ;
2424import type { FindArgs , SelectIncludeOmit , WhereInput } from '../../crud-types' ;
2525import {
@@ -54,130 +54,17 @@ import { getCrudDialect } from '../dialects';
5454import type { BaseCrudDialect } from '../dialects/base-dialect' ;
5555import { InputValidator } from '../validator' ;
5656
57- /**
58- * List of core CRUD operations. It excludes the 'orThrow' variants.
59- */
60- export const CoreCrudOperations = [
61- 'findMany' ,
62- 'findUnique' ,
63- 'findFirst' ,
64- 'create' ,
65- 'createMany' ,
66- 'createManyAndReturn' ,
67- 'update' ,
68- 'updateMany' ,
69- 'updateManyAndReturn' ,
70- 'upsert' ,
71- 'delete' ,
72- 'deleteMany' ,
73- 'count' ,
74- 'aggregate' ,
75- 'groupBy' ,
76- 'exists' ,
77- ] as const ;
78-
79- /**
80- * List of core CRUD operations. It excludes the 'orThrow' variants.
81- */
82- export type CoreCrudOperations = ( typeof CoreCrudOperations ) [ number ] ;
83-
84- /**
85- * List of core read operations. It excludes the 'orThrow' variants.
86- */
87- export const CoreReadOperations = [
88- 'findMany' ,
89- 'findUnique' ,
90- 'findFirst' ,
91- 'count' ,
92- 'aggregate' ,
93- 'groupBy' ,
94- 'exists' ,
95- ] as const ;
96-
97- /**
98- * List of core read operations. It excludes the 'orThrow' variants.
99- */
100- export type CoreReadOperations = ( typeof CoreReadOperations ) [ number ] ;
101-
102- /**
103- * List of core write operations.
104- */
105- export const CoreWriteOperations = [
106- 'create' ,
107- 'createMany' ,
108- 'createManyAndReturn' ,
109- 'update' ,
110- 'updateMany' ,
111- 'updateManyAndReturn' ,
112- 'upsert' ,
113- 'delete' ,
114- 'deleteMany' ,
115- ] as const ;
116-
117- /**
118- * List of core write operations.
119- */
120- export type CoreWriteOperations = ( typeof CoreWriteOperations ) [ number ] ;
121-
122- /**
123- * List of core create operations.
124- */
125- export const CoreCreateOperations = [ 'create' , 'createMany' , 'createManyAndReturn' , 'upsert' ] as const ;
126-
127- /**
128- * List of core create operations.
129- */
130- export type CoreCreateOperations = ( typeof CoreCreateOperations ) [ number ] ;
131-
132- /**
133- * List of core update operations.
134- */
135- export const CoreUpdateOperations = [ 'update' , 'updateMany' , 'updateManyAndReturn' , 'upsert' ] as const ;
136-
137- /**
138- * List of core update operations.
139- */
140- export type CoreUpdateOperations = ( typeof CoreUpdateOperations ) [ number ] ;
141-
142- /**
143- * List of core delete operations.
144- */
145- export const CoreDeleteOperations = [ 'delete' , 'deleteMany' ] as const ;
146-
147- /**
148- * List of core delete operations.
149- */
150- export type CoreDeleteOperations = ( typeof CoreDeleteOperations ) [ number ] ;
151-
152- /**
153- * List of all CRUD operations, including 'orThrow' variants.
154- */
155- export const AllCrudOperations = [ ...CoreCrudOperations , 'findUniqueOrThrow' , 'findFirstOrThrow' ] as const ;
156-
157- /**
158- * List of all CRUD operations, including 'orThrow' variants.
159- */
160- export type AllCrudOperations = ( typeof AllCrudOperations ) [ number ] ;
161-
162- /**
163- * List of all read operations, including 'orThrow' variants.
164- */
165- export const AllReadOperations = [ ...CoreReadOperations , 'findUniqueOrThrow' , 'findFirstOrThrow' ] as const ;
166-
167- /**
168- * List of all read operations, including 'orThrow' variants.
169- */
170- export type AllReadOperations = ( typeof AllReadOperations ) [ number ] ;
171-
172- /**
173- * List of all write operations - simply an alias of CoreWriteOperations.
174- */
175- export const AllWriteOperations = CoreWriteOperations ;
176-
177- /**
178- * List of all write operations - simply an alias of CoreWriteOperations.
179- */
180- export type AllWriteOperations = CoreWriteOperations ;
57+ export {
58+ AllCrudOperations ,
59+ AllReadOperations ,
60+ AllWriteOperations ,
61+ CoreCreateOperations ,
62+ CoreCrudOperations ,
63+ CoreDeleteOperations ,
64+ CoreReadOperations ,
65+ CoreUpdateOperations ,
66+ CoreWriteOperations ,
67+ } from '../../constants' ;
18168
18269// context for nested relation operations
18370export type FromRelationContext = {
0 commit comments