vsrepo 1.3.0 → 1.3.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/README.md +714 -480
- package/dist/VSRepository.d.ts +36 -19
- package/dist/VSRepository.js +1 -0
- package/dist/internal/resolvers/dbAndPrismaArgs.resolve.js +4 -1
- package/dist/internal/resolvers/dinamic-method-customization.resolve.js +14 -2
- package/dist/internal/resolvers/dinamic-method-info.resolve.js +14 -0
- package/package.json +1 -1
package/dist/VSRepository.d.ts
CHANGED
|
@@ -239,12 +239,21 @@ type SelectedModel<M extends Prisma.ModelName, S, SelectModels, IM = never, Incl
|
|
|
239
239
|
? PrecomputedIncludes<M, IncludeModels>[IM]
|
|
240
240
|
: FullModelType<M>;
|
|
241
241
|
|
|
242
|
+
/**
|
|
243
|
+
* Strips the `Distinct{Fields}` suffix used by read methods (e.g. `findManyDistinctIdadeAndCargo`).
|
|
244
|
+
* The distinct fields are resolved from the method name at build time, so they never
|
|
245
|
+
* become part of the runtime `where` fields extracted by `ExtractFields`.
|
|
246
|
+
*/
|
|
247
|
+
type StripDistinctFields<R extends string> =
|
|
248
|
+
R extends `${infer F}Distinct${string}` ? F : R;
|
|
249
|
+
|
|
242
250
|
type CleanFields<R extends string> =
|
|
243
|
-
R extends `${infer F}PaginatedAndOrdered` ? F :
|
|
244
|
-
R extends `${infer F}OrderedAndPaginated` ? F :
|
|
245
|
-
R extends `${infer F}Paginated` ? F :
|
|
246
|
-
R extends `${infer F}Ordered` ? F :
|
|
247
|
-
R extends `${infer F}SkipDuplicates` ? F :
|
|
251
|
+
R extends `${infer F}PaginatedAndOrdered` ? StripDistinctFields<F> :
|
|
252
|
+
R extends `${infer F}OrderedAndPaginated` ? StripDistinctFields<F> :
|
|
253
|
+
R extends `${infer F}Paginated` ? StripDistinctFields<F> :
|
|
254
|
+
R extends `${infer F}Ordered` ? StripDistinctFields<F> :
|
|
255
|
+
R extends `${infer F}SkipDuplicates` ? StripDistinctFields<F> :
|
|
256
|
+
StripDistinctFields<R>;
|
|
248
257
|
|
|
249
258
|
/**
|
|
250
259
|
* Additional options accepted by repository methods.
|
|
@@ -291,9 +300,17 @@ export type MethodOptionsModel<TRepo> =
|
|
|
291
300
|
? MethodOptions<keyof ExtractSelectModels<Config> | false, keyof ExtractIncludeModels<Config>>
|
|
292
301
|
: never;
|
|
293
302
|
|
|
303
|
+
type MethodOptionsWithInclude<
|
|
304
|
+
S,
|
|
305
|
+
IM extends PropertyKey,
|
|
306
|
+
TIncludes,
|
|
307
|
+
Excluded extends keyof MethodOptions<S, keyof TIncludes> = never
|
|
308
|
+
> = Omit<MethodOptions<S, keyof TIncludes>, Excluded>
|
|
309
|
+
& ({ includeModel: IM } | { includeModel?: never });
|
|
310
|
+
|
|
294
311
|
type MethodFn<MethodName extends string, T, M extends Prisma.ModelName, R extends string, SelectModels, DefaultSelect extends keyof SelectModels | false, I, IncludeModels> =
|
|
295
312
|
<S extends keyof SelectModels | false = DefaultSelect, IM extends keyof IncludeModels = never>(
|
|
296
|
-
...args: [...ExtractFields<T, CleanFields<R>, I>, ...ExtraArgs<MethodName, R, I>, options?:
|
|
313
|
+
...args: [...ExtractFields<T, CleanFields<R>, I>, ...ExtraArgs<MethodName, R, I>, options?: MethodOptionsWithInclude<S, IM, IncludeModels>]
|
|
297
314
|
) => Promise<ResolveReturnType<MethodName, SelectedModel<M, S, SelectModels, IM, IncludeModels>>>;
|
|
298
315
|
|
|
299
316
|
type GetMappedMethod<K extends string, MethodConf> =
|
|
@@ -349,7 +366,7 @@ type MethodFactory<T, M extends Prisma.ModelName, K extends string, SelectModels
|
|
|
349
366
|
K extends `findWhere${string}`
|
|
350
367
|
? {
|
|
351
368
|
/** @deprecated Use findOneWhere instead. */
|
|
352
|
-
<S extends keyof SelectModels | false = DefaultSelect, IM extends keyof IncludeModels = never>(...args: [...ExtractFields<T, CleanFields<ExtractPatternBase<K>>, I>, ...ExtraArgs<GetMappedMethod<K, MethodConf>, ExtractPatternBase<K>, I>, options?:
|
|
369
|
+
<S extends keyof SelectModels | false = DefaultSelect, IM extends keyof IncludeModels = never>(...args: [...ExtractFields<T, CleanFields<ExtractPatternBase<K>>, I>, ...ExtraArgs<GetMappedMethod<K, MethodConf>, ExtractPatternBase<K>, I>, options?: MethodOptionsWithInclude<S, IM, IncludeModels>]): Promise<ResolveReturnType<GetMappedMethod<K, MethodConf>, SelectedModel<M, S, SelectModels, IM, IncludeModels>>>;
|
|
353
370
|
}
|
|
354
371
|
: MethodFn<GetMappedMethod<K, MethodConf>, T, M, ExtractPatternBase<K>, SelectModels, DefaultSelect, I, IncludeModels>;
|
|
355
372
|
|
|
@@ -703,47 +720,47 @@ type AllBaseMethods<
|
|
|
703
720
|
> = {
|
|
704
721
|
/** Fetches a record by its primary key (PK). */
|
|
705
722
|
get: <S extends keyof TSelects | false = _DS<Config, C, 'get', TSelects>, IM extends keyof TIncludes = never>(
|
|
706
|
-
pk: _Pk<T, Config>, options?:
|
|
723
|
+
pk: _Pk<T, Config>, options?: MethodOptionsWithInclude<S, IM, TIncludes>
|
|
707
724
|
) => Promise<_Ret<M, TSelects, S, TDefault, IM, TIncludes> | null>;
|
|
708
725
|
|
|
709
726
|
/** Fetches a record by PK and throws `VSRepoRuntimeError` if not found. */
|
|
710
727
|
getOrThrow: <S extends keyof TSelects | false = _DS<Config, C, 'getOrThrow', TSelects>, IM extends keyof TIncludes = never>(
|
|
711
|
-
pk: _Pk<T, Config>, options?:
|
|
728
|
+
pk: _Pk<T, Config>, options?: MethodOptionsWithInclude<S, IM, TIncludes>
|
|
712
729
|
) => Promise<_Ret<M, TSelects, S, TDefault, IM, TIncludes>>;
|
|
713
730
|
|
|
714
731
|
/** Fetches multiple records by a list of primary keys (PKs). */
|
|
715
732
|
getList: <S extends keyof TSelects | false = _DS<Config, C, 'getList', TSelects>, IM extends keyof TIncludes = never>(
|
|
716
|
-
pks: _Pk<T, Config>[], options?:
|
|
733
|
+
pks: _Pk<T, Config>[], options?: MethodOptionsWithInclude<S, IM, TIncludes>
|
|
717
734
|
) => Promise<_Ret<M, TSelects, S, TDefault, IM, TIncludes>[]>;
|
|
718
735
|
|
|
719
736
|
/** Deletes a record identified by its primary key (PK). */
|
|
720
737
|
remove: <S extends keyof TSelects | false = _DS<Config, C, 'remove', TSelects>, IM extends keyof TIncludes = never>(
|
|
721
|
-
pk: _Pk<T, Config>, options?:
|
|
738
|
+
pk: _Pk<T, Config>, options?: MethodOptionsWithInclude<S, IM, TIncludes>
|
|
722
739
|
) => Promise<_Ret<M, TSelects, S, TDefault, IM, TIncludes>>;
|
|
723
740
|
|
|
724
741
|
/** Inserts or updates (upsert) a record. */
|
|
725
742
|
save: <S extends keyof TSelects | false = _DS<Config, C, 'save', TSelects>, IM extends keyof TIncludes = never>(
|
|
726
|
-
obj: UpsertWithRelations<T, M, TRelations>, options?:
|
|
743
|
+
obj: UpsertWithRelations<T, M, TRelations>, options?: MethodOptionsWithInclude<S, IM, TIncludes>
|
|
727
744
|
) => Promise<_Ret<M, TSelects, S, TDefault, IM, TIncludes>>;
|
|
728
745
|
|
|
729
746
|
/** Saves an array of objects in a single automatic transaction. */
|
|
730
747
|
saveList: <S extends keyof TSelects | false = _DS<Config, C, 'saveList', TSelects>, IM extends keyof TIncludes = never>(
|
|
731
|
-
objs: UpsertWithRelations<T, M, TRelations>[], options?:
|
|
748
|
+
objs: UpsertWithRelations<T, M, TRelations>[], options?: MethodOptionsWithInclude<S, IM, TIncludes, 'db'> & { db?: DbTransaction }
|
|
732
749
|
) => Promise<_Ret<M, TSelects, S, TDefault, IM, TIncludes>[]>;
|
|
733
750
|
|
|
734
751
|
/** Partially updates (patch) an existing record by its primary key (PK). */
|
|
735
752
|
patch: <S extends keyof TSelects | false = _DS<Config, C, 'patch', TSelects>, IM extends keyof TIncludes = never>(
|
|
736
|
-
pk: _Pk<T, Config>, obj: PatchWithRelations<T, M, TRelations>, options?:
|
|
753
|
+
pk: _Pk<T, Config>, obj: PatchWithRelations<T, M, TRelations>, options?: MethodOptionsWithInclude<S, IM, TIncludes>
|
|
737
754
|
) => Promise<_Ret<M, TSelects, S, TDefault, IM, TIncludes>>;
|
|
738
755
|
|
|
739
756
|
/** Partially updates multiple records via `[pk, obj]` tuples in an automatic transaction. */
|
|
740
757
|
patchList: <S extends keyof TSelects | false = _DS<Config, C, 'patchList', TSelects>, IM extends keyof TIncludes = never>(
|
|
741
|
-
tuples: [pk: _Pk<T, Config>, obj: PatchWithRelations<T, M, TRelations>][], options?:
|
|
758
|
+
tuples: [pk: _Pk<T, Config>, obj: PatchWithRelations<T, M, TRelations>][], options?: MethodOptionsWithInclude<S, IM, TIncludes, 'db'> & { db?: DbTransaction }
|
|
742
759
|
) => Promise<_Ret<M, TSelects, S, TDefault, IM, TIncludes>[]>;
|
|
743
760
|
|
|
744
761
|
/** Fetches a record by PK and deep-merges it with the provided object **in memory**. */
|
|
745
762
|
merge: <S extends keyof TSelects | false = _DS<Config, C, 'merge', TSelects>, IM extends keyof TIncludes = never>(
|
|
746
|
-
pk: _Pk<T, Config>, obj: UpdateWithRelations<T, M, TRelations>, options?:
|
|
763
|
+
pk: _Pk<T, Config>, obj: UpdateWithRelations<T, M, TRelations>, options?: MethodOptionsWithInclude<S, IM, TIncludes>
|
|
747
764
|
) => Promise<_Ret<M, TSelects, S, TDefault, IM, TIncludes> | null>;
|
|
748
765
|
|
|
749
766
|
/** Deletes multiple records by their primary keys. */
|
|
@@ -751,7 +768,7 @@ type AllBaseMethods<
|
|
|
751
768
|
|
|
752
769
|
/** Fetches all records (respects `requiredWhere` when set). */
|
|
753
770
|
getAll: <S extends keyof TSelects | false = _DS<Config, C, 'getAll', TSelects>, IM extends keyof TIncludes = never>(
|
|
754
|
-
options?:
|
|
771
|
+
options?: MethodOptionsWithInclude<S, IM, TIncludes> & {
|
|
755
772
|
pagination?: PaginationOptions<I extends { cursorInput: infer Curs } ? Curs : unknown>;
|
|
756
773
|
/**
|
|
757
774
|
* Ordering to apply to the query.
|
|
@@ -770,7 +787,7 @@ type AllBaseMethods<
|
|
|
770
787
|
|
|
771
788
|
/** Marks a record as deleted (soft-delete). */
|
|
772
789
|
softRemove: <S extends keyof TSelects | false = _DS<Config, C, 'softRemove', TSelects>, IM extends keyof TIncludes = never>(
|
|
773
|
-
pk: _Pk<T, Config>, options?:
|
|
790
|
+
pk: _Pk<T, Config>, options?: MethodOptionsWithInclude<S, IM, TIncludes, 'see'>
|
|
774
791
|
) => Promise<_Ret<M, TSelects, S, TDefault, IM, TIncludes>>;
|
|
775
792
|
|
|
776
793
|
/** Marks multiple records as deleted (soft-delete) in batch. */
|
|
@@ -778,7 +795,7 @@ type AllBaseMethods<
|
|
|
778
795
|
|
|
779
796
|
/** Restores a record previously marked as deleted (soft-delete). */
|
|
780
797
|
restore: <S extends keyof TSelects | false = _DS<Config, C, 'restore', TSelects>, IM extends keyof TIncludes = never>(
|
|
781
|
-
pk: _Pk<T, Config>, options?:
|
|
798
|
+
pk: _Pk<T, Config>, options?: MethodOptionsWithInclude<S, IM, TIncludes, 'see'>
|
|
782
799
|
) => Promise<_Ret<M, TSelects, S, TDefault, IM, TIncludes>>;
|
|
783
800
|
|
|
784
801
|
/** Restores multiple records previously marked as deleted (soft-delete) in batch. */
|
package/dist/VSRepository.js
CHANGED
|
@@ -144,6 +144,7 @@ class VSRepository {
|
|
|
144
144
|
? args.at(dinamicMethodInfo.updateIndex)
|
|
145
145
|
: undefined,
|
|
146
146
|
withOrdenationAndPagination: !dinamicMethodInfo.ignoreOrderByAndPagination,
|
|
147
|
+
distinctKeys: dinamicMethodCustomization.distinctKeys,
|
|
147
148
|
};
|
|
148
149
|
if (!dinamicMethodInfo.ignoreWhere) {
|
|
149
150
|
resolveDbAndPrismaArgsData.specificWhere = (0, specific_where_resolve_1.resolveSpecificWhere)(args, dinamicMethodWhereOps.prettyWheres);
|
|
@@ -5,7 +5,7 @@ const method_options_validate_1 = require("../validation/method-options.validate
|
|
|
5
5
|
const merge_wheres_resolve_1 = require("./merge-wheres.resolve");
|
|
6
6
|
const select_resolve_1 = require("./select.resolve");
|
|
7
7
|
function resolveDbAndPrismaArgs(data) {
|
|
8
|
-
const { baseConfig, instance, options, wherePkValue, withoutSelect, withoutWhere, specificSelect, dataPayload, createPayload, updatePayload, alreadyValidatedOptions, specificWhere, pushWhere, ordenation, pagination, skipDuplicates, forceSeeMode, withOrdenationAndPagination, } = data;
|
|
8
|
+
const { baseConfig, instance, options, wherePkValue, withoutSelect, withoutWhere, specificSelect, dataPayload, createPayload, updatePayload, alreadyValidatedOptions, specificWhere, pushWhere, ordenation, pagination, skipDuplicates, forceSeeMode, withOrdenationAndPagination, distinctKeys, } = data;
|
|
9
9
|
const validatedOptions = alreadyValidatedOptions && options
|
|
10
10
|
? options
|
|
11
11
|
: (0, method_options_validate_1.validateMethodOptions)(options, instance);
|
|
@@ -50,5 +50,8 @@ function resolveDbAndPrismaArgs(data) {
|
|
|
50
50
|
if (skipDuplicates !== undefined) {
|
|
51
51
|
prismaArgs.skipDuplicates = skipDuplicates;
|
|
52
52
|
}
|
|
53
|
+
if (distinctKeys !== undefined) {
|
|
54
|
+
prismaArgs.distinct = distinctKeys;
|
|
55
|
+
}
|
|
53
56
|
return { db, prismaArgs };
|
|
54
57
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.resolveDinamicMethodCustomization = resolveDinamicMethodCustomization;
|
|
4
|
+
const uncapitalize_util_1 = require("../utils/uncapitalize.util");
|
|
4
5
|
function resolveDinamicMethodCustomization(instance, dinamicMethodInfo, originalKey) {
|
|
5
6
|
const dinamicMethodCustomization = {};
|
|
6
7
|
if (!dinamicMethodInfo.ignoreSkipDuplicates) {
|
|
@@ -10,8 +11,10 @@ function resolveDinamicMethodCustomization(instance, dinamicMethodInfo, original
|
|
|
10
11
|
}
|
|
11
12
|
}
|
|
12
13
|
if (!dinamicMethodInfo.ignoreOrderByAndPagination) {
|
|
13
|
-
dinamicMethodCustomization.injectOrdenation =
|
|
14
|
-
|
|
14
|
+
dinamicMethodCustomization.injectOrdenation =
|
|
15
|
+
instance.methods?.[originalKey]?.injectOrdenation;
|
|
16
|
+
dinamicMethodCustomization.injectPagination =
|
|
17
|
+
instance.methods?.[originalKey]?.injectPagination;
|
|
15
18
|
if (dinamicMethodInfo.keyToMapReplaced.endsWith("PaginatedAndOrdered")) {
|
|
16
19
|
dinamicMethodCustomization.orderPosition = -2;
|
|
17
20
|
dinamicMethodCustomization.paginationPosition = -3;
|
|
@@ -41,5 +44,14 @@ function resolveDinamicMethodCustomization(instance, dinamicMethodInfo, original
|
|
|
41
44
|
dinamicMethodInfo.argsCount++;
|
|
42
45
|
}
|
|
43
46
|
}
|
|
47
|
+
if (!dinamicMethodInfo.ignoreDistinct) {
|
|
48
|
+
const keySplitedDistinct = dinamicMethodInfo.keyToMapReplaced.split("Distinct");
|
|
49
|
+
if (keySplitedDistinct[1]) {
|
|
50
|
+
dinamicMethodCustomization.distinctKeys = keySplitedDistinct[1]
|
|
51
|
+
.split("And")
|
|
52
|
+
.map(uncapitalize_util_1.uncapitalize);
|
|
53
|
+
}
|
|
54
|
+
dinamicMethodInfo.keyToMapReplaced = keySplitedDistinct[0];
|
|
55
|
+
}
|
|
44
56
|
return dinamicMethodCustomization;
|
|
45
57
|
}
|
|
@@ -15,6 +15,7 @@ function resolveDinamicMethodInfo(instance, dinamicMethod, originalKey) {
|
|
|
15
15
|
ignoreSkipDuplicates: true,
|
|
16
16
|
whereParams: [],
|
|
17
17
|
otherParams: [],
|
|
18
|
+
ignoreDistinct: true,
|
|
18
19
|
};
|
|
19
20
|
if (dinamicMethod === "aggregate") {
|
|
20
21
|
dinamicMethodInfo.keyToMapReplaced = dinamicMethod.replace("aggregate", "");
|
|
@@ -45,6 +46,7 @@ function resolveDinamicMethodInfo(instance, dinamicMethod, originalKey) {
|
|
|
45
46
|
else if (dinamicMethod.startsWith("findFirstOrThrowBy")) {
|
|
46
47
|
dinamicMethodInfo.keyToMapReplaced = dinamicMethod.replace("findFirstOrThrowBy", "");
|
|
47
48
|
dinamicMethodInfo.ignoreOrderByAndPagination = false;
|
|
49
|
+
dinamicMethodInfo.ignoreDistinct = false;
|
|
48
50
|
dinamicMethodInfo.method = "findFirstOrThrow";
|
|
49
51
|
}
|
|
50
52
|
else if (dinamicMethod.startsWith("findFirstOrThrow")) {
|
|
@@ -52,11 +54,13 @@ function resolveDinamicMethodInfo(instance, dinamicMethod, originalKey) {
|
|
|
52
54
|
dinamicMethodInfo.ignoreOrderByAndPagination = false;
|
|
53
55
|
dinamicMethodInfo.ignoreWhere = true;
|
|
54
56
|
dinamicMethodInfo.onlyBaseWheres = true;
|
|
57
|
+
dinamicMethodInfo.ignoreDistinct = false;
|
|
55
58
|
dinamicMethodInfo.method = "findFirstOrThrow";
|
|
56
59
|
}
|
|
57
60
|
else if (dinamicMethod.startsWith("findFirstBy")) {
|
|
58
61
|
dinamicMethodInfo.keyToMapReplaced = dinamicMethod.replace("findFirstBy", "");
|
|
59
62
|
dinamicMethodInfo.ignoreOrderByAndPagination = false;
|
|
63
|
+
dinamicMethodInfo.ignoreDistinct = false;
|
|
60
64
|
dinamicMethodInfo.method = "findFirst";
|
|
61
65
|
}
|
|
62
66
|
else if (dinamicMethod.startsWith("findFirst")) {
|
|
@@ -64,6 +68,7 @@ function resolveDinamicMethodInfo(instance, dinamicMethod, originalKey) {
|
|
|
64
68
|
dinamicMethodInfo.ignoreOrderByAndPagination = false;
|
|
65
69
|
dinamicMethodInfo.ignoreWhere = true;
|
|
66
70
|
dinamicMethodInfo.onlyBaseWheres = true;
|
|
71
|
+
dinamicMethodInfo.ignoreDistinct = false;
|
|
67
72
|
dinamicMethodInfo.method = "findFirst";
|
|
68
73
|
}
|
|
69
74
|
else if (dinamicMethod.startsWith("countBy")) {
|
|
@@ -95,6 +100,7 @@ function resolveDinamicMethodInfo(instance, dinamicMethod, originalKey) {
|
|
|
95
100
|
dinamicMethodInfo.keyToMapReplaced = dinamicMethod.replace("existsBy", "");
|
|
96
101
|
dinamicMethodInfo.ignoreSelect = true;
|
|
97
102
|
dinamicMethodInfo.existsMode = true;
|
|
103
|
+
dinamicMethodInfo.ignoreDistinct = false;
|
|
98
104
|
dinamicMethodInfo.method = "findFirst";
|
|
99
105
|
}
|
|
100
106
|
else if (dinamicMethod.startsWith("existsWhere")) {
|
|
@@ -103,6 +109,7 @@ function resolveDinamicMethodInfo(instance, dinamicMethod, originalKey) {
|
|
|
103
109
|
dinamicMethodInfo.existsMode = true;
|
|
104
110
|
dinamicMethodInfo.ignoreWhere = true;
|
|
105
111
|
dinamicMethodInfo.onlyBaseWheres = true;
|
|
112
|
+
dinamicMethodInfo.ignoreDistinct = false;
|
|
106
113
|
dinamicMethodInfo.method = "findFirst";
|
|
107
114
|
dinamicMethodInfo.whereIndex = 0;
|
|
108
115
|
dinamicMethodInfo.otherParams.push("where");
|
|
@@ -111,6 +118,7 @@ function resolveDinamicMethodInfo(instance, dinamicMethod, originalKey) {
|
|
|
111
118
|
else if (dinamicMethod.startsWith("findManyBy")) {
|
|
112
119
|
dinamicMethodInfo.keyToMapReplaced = dinamicMethod.replace("findManyBy", "");
|
|
113
120
|
dinamicMethodInfo.ignoreOrderByAndPagination = false;
|
|
121
|
+
dinamicMethodInfo.ignoreDistinct = false;
|
|
114
122
|
dinamicMethodInfo.method = "findMany";
|
|
115
123
|
}
|
|
116
124
|
else if (dinamicMethod.startsWith("findMany")) {
|
|
@@ -118,6 +126,7 @@ function resolveDinamicMethodInfo(instance, dinamicMethod, originalKey) {
|
|
|
118
126
|
dinamicMethodInfo.ignoreOrderByAndPagination = false;
|
|
119
127
|
dinamicMethodInfo.ignoreWhere = true;
|
|
120
128
|
dinamicMethodInfo.onlyBaseWheres = true;
|
|
129
|
+
dinamicMethodInfo.ignoreDistinct = false;
|
|
121
130
|
dinamicMethodInfo.method = "findMany";
|
|
122
131
|
}
|
|
123
132
|
else if (dinamicMethod.startsWith("createManyAndReturn")) {
|
|
@@ -223,6 +232,7 @@ function resolveDinamicMethodInfo(instance, dinamicMethod, originalKey) {
|
|
|
223
232
|
dinamicMethodInfo.ignoreOrderByAndPagination = false;
|
|
224
233
|
dinamicMethodInfo.ignoreWhere = true;
|
|
225
234
|
dinamicMethodInfo.onlyBaseWheres = true;
|
|
235
|
+
dinamicMethodInfo.ignoreDistinct = false;
|
|
226
236
|
dinamicMethodInfo.method = "findFirst";
|
|
227
237
|
dinamicMethodInfo.whereIndex = 0;
|
|
228
238
|
dinamicMethodInfo.otherParams.push("where");
|
|
@@ -233,6 +243,7 @@ function resolveDinamicMethodInfo(instance, dinamicMethod, originalKey) {
|
|
|
233
243
|
dinamicMethodInfo.ignoreOrderByAndPagination = false;
|
|
234
244
|
dinamicMethodInfo.ignoreWhere = true;
|
|
235
245
|
dinamicMethodInfo.onlyBaseWheres = true;
|
|
246
|
+
dinamicMethodInfo.ignoreDistinct = false;
|
|
236
247
|
dinamicMethodInfo.method = "findFirst";
|
|
237
248
|
dinamicMethodInfo.whereIndex = 0;
|
|
238
249
|
dinamicMethodInfo.otherParams.push("where");
|
|
@@ -243,6 +254,7 @@ function resolveDinamicMethodInfo(instance, dinamicMethod, originalKey) {
|
|
|
243
254
|
dinamicMethodInfo.ignoreOrderByAndPagination = false;
|
|
244
255
|
dinamicMethodInfo.ignoreWhere = true;
|
|
245
256
|
dinamicMethodInfo.onlyBaseWheres = true;
|
|
257
|
+
dinamicMethodInfo.ignoreDistinct = false;
|
|
246
258
|
dinamicMethodInfo.method = "findMany";
|
|
247
259
|
dinamicMethodInfo.whereIndex = 0;
|
|
248
260
|
dinamicMethodInfo.otherParams.push("where");
|
|
@@ -251,11 +263,13 @@ function resolveDinamicMethodInfo(instance, dinamicMethod, originalKey) {
|
|
|
251
263
|
else if (dinamicMethod.startsWith("findOneBy")) {
|
|
252
264
|
dinamicMethodInfo.keyToMapReplaced = dinamicMethod.replace("findOneBy", "");
|
|
253
265
|
dinamicMethodInfo.ignoreOrderByAndPagination = false;
|
|
266
|
+
dinamicMethodInfo.ignoreDistinct = false;
|
|
254
267
|
dinamicMethodInfo.method = "findFirst";
|
|
255
268
|
}
|
|
256
269
|
else if (dinamicMethod.startsWith("findBy")) {
|
|
257
270
|
dinamicMethodInfo.keyToMapReplaced = dinamicMethod.replace("findBy", "");
|
|
258
271
|
dinamicMethodInfo.ignoreOrderByAndPagination = false;
|
|
272
|
+
dinamicMethodInfo.ignoreDistinct = false;
|
|
259
273
|
dinamicMethodInfo.method = instance.methods?.[originalKey]?.fbMode === "one" ? "findFirst" : "findMany";
|
|
260
274
|
}
|
|
261
275
|
else {
|