vsrepo 1.3.4 → 1.3.6
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 +181 -137
- package/README.pt-BR.md +188 -144
- package/dist/DynamicRepository.d.ts +36 -15
- package/dist/VSRepoError.d.ts +21 -1
- package/dist/VSRepository.d.ts +126 -87
- package/dist/VSRepository.js +49 -49
- package/dist/internal/constants/dynamic-methods-key.constant.js +4 -0
- package/dist/internal/decorators/dynamic-method.decorator.js +4 -4
- package/dist/internal/decorators/query-method.decorator.js +7 -3
- package/dist/internal/entities/dynamic-method-metadata.entity.js +3 -3
- package/dist/internal/resolvers/base-methods.resolve.js +2 -2
- package/dist/internal/resolvers/dbAndPrismaArgs.resolve.js +7 -4
- package/dist/internal/resolvers/dynamic-method-customization.resolve.js +57 -0
- package/dist/internal/resolvers/dynamic-method-info.resolve.js +279 -0
- package/dist/internal/resolvers/dynamic-methods-metadata.resolve.js +2 -2
- package/dist/internal/resolvers/pretty-wheres.resolve.js +8 -8
- package/dist/internal/resolvers/types/dynamic-method-where-ops.type.js +2 -0
- package/dist/internal/utils/schemas.util.js +8 -2
- package/dist/internal/validation/constructor-config.validate.js +7 -4
- package/dist/internal/validation/method-options.validate.js +10 -3
- package/package.json +11 -2
- package/scripts/configure-prisma-import.mjs +12 -8
- package/scripts/copy-types.mjs +16 -16
- package/dist/internal/constants/dinamic-methods-key.constant.js +0 -4
- package/dist/internal/resolvers/dinamic-method-customization.resolve.js +0 -57
- package/dist/internal/resolvers/dinamic-method-info.resolve.js +0 -279
- /package/dist/internal/{resolvers/types/dinamic-method-customization.type.js → errors/types/vs-repo-runtime-error-code.type.js} +0 -0
- /package/dist/internal/resolvers/types/{dinamic-method-info.type.js → dynamic-method-customization.type.js} +0 -0
- /package/dist/internal/resolvers/types/{dinamic-method-where-ops.type.js → dynamic-method-info.type.js} +0 -0
package/dist/VSRepository.js
CHANGED
|
@@ -23,8 +23,8 @@ const prisma_client_validate_1 = require("./internal/validation/prisma-client.va
|
|
|
23
23
|
const vs_repo_error_1 = require("./internal/errors/vs-repo.error");
|
|
24
24
|
const base_methods_resolve_1 = require("./internal/resolvers/base-methods.resolve");
|
|
25
25
|
const logger_util_1 = require("./internal/utils/logger.util");
|
|
26
|
-
const
|
|
27
|
-
const
|
|
26
|
+
const dynamic_method_info_resolve_1 = require("./internal/resolvers/dynamic-method-info.resolve");
|
|
27
|
+
const dynamic_method_customization_resolve_1 = require("./internal/resolvers/dynamic-method-customization.resolve");
|
|
28
28
|
const pretty_wheres_resolve_1 = require("./internal/resolvers/pretty-wheres.resolve");
|
|
29
29
|
const specific_where_resolve_1 = require("./internal/resolvers/specific-where.resolve");
|
|
30
30
|
const dbAndPrismaArgs_resolve_1 = require("./internal/resolvers/dbAndPrismaArgs.resolve");
|
|
@@ -41,7 +41,7 @@ class VSRepository {
|
|
|
41
41
|
requiredWhere;
|
|
42
42
|
relations;
|
|
43
43
|
methods;
|
|
44
|
-
|
|
44
|
+
defaultOrdering;
|
|
45
45
|
constructor(config) {
|
|
46
46
|
const validatedConfig = (0, constructor_config_validate_1.validateConstructorConfig)(config);
|
|
47
47
|
this.vsrepocache = new Map();
|
|
@@ -54,7 +54,7 @@ class VSRepository {
|
|
|
54
54
|
this.relations = validatedConfig.relations;
|
|
55
55
|
this.requiredWhere = validatedConfig.requiredWhere;
|
|
56
56
|
this.methods = validatedConfig.methods;
|
|
57
|
-
this.
|
|
57
|
+
this.defaultOrdering = validatedConfig.defaultOrdering;
|
|
58
58
|
}
|
|
59
59
|
extend(extensionFunc) {
|
|
60
60
|
const extension = (0, extension_validate_1.validateExtension)(extensionFunc, this);
|
|
@@ -105,19 +105,19 @@ class VSRepository {
|
|
|
105
105
|
continue;
|
|
106
106
|
}
|
|
107
107
|
methodToMap = methods[originalKey]?.proxyTo ?? methodToMap;
|
|
108
|
-
const
|
|
109
|
-
const
|
|
110
|
-
const
|
|
108
|
+
const dynamicMethodInfo = (0, dynamic_method_info_resolve_1.resolveDynamicMethodInfo)(buildInstance, methodToMap, originalKey);
|
|
109
|
+
const dynamicMethodCustomization = (0, dynamic_method_customization_resolve_1.resolveDynamicMethodCustomization)(buildInstance, dynamicMethodInfo, originalKey);
|
|
110
|
+
const dynamicMethodWhereOps = {
|
|
111
111
|
uglyWheres: [],
|
|
112
112
|
prettyWheres: [],
|
|
113
113
|
whereType: methods[originalKey]?.whereType ?? "extending",
|
|
114
114
|
pushWhere: methods[originalKey]?.pushWhere,
|
|
115
115
|
};
|
|
116
|
-
if (!
|
|
117
|
-
(0, pretty_wheres_resolve_1.resolvePrettyWheres)(
|
|
116
|
+
if (!dynamicMethodInfo.ignoreWhere) {
|
|
117
|
+
(0, pretty_wheres_resolve_1.resolvePrettyWheres)(dynamicMethodInfo, dynamicMethodWhereOps);
|
|
118
118
|
// if (showWorking) {
|
|
119
119
|
// const argsSimulation: any[] = [];
|
|
120
|
-
// for (let x = 0; x <
|
|
120
|
+
// for (let x = 0; x < dynamicMethodInfo.argsCount; x++) {
|
|
121
121
|
// argsSimulation[x] = "00";
|
|
122
122
|
// }
|
|
123
123
|
// logger(
|
|
@@ -126,24 +126,24 @@ class VSRepository {
|
|
|
126
126
|
// buildInstance.tableName,
|
|
127
127
|
// resolveSpecificWhere(
|
|
128
128
|
// argsSimulation,
|
|
129
|
-
//
|
|
129
|
+
// dynamicMethodWhereOps.prettyWheres,
|
|
130
130
|
// ),
|
|
131
131
|
// );
|
|
132
132
|
// // logger(
|
|
133
133
|
// // `Where object resolved to ${methodToMap}:`,
|
|
134
134
|
// // "build",
|
|
135
135
|
// // buildInstance.tableName,
|
|
136
|
-
// //
|
|
136
|
+
// // dynamicMethodWhereOps.prettyWheres,
|
|
137
137
|
// // );
|
|
138
138
|
// }
|
|
139
139
|
}
|
|
140
140
|
let select = undefined;
|
|
141
|
-
if (
|
|
141
|
+
if (dynamicMethodInfo.existsMode) {
|
|
142
142
|
select = { [buildInstance.pkName]: true };
|
|
143
143
|
}
|
|
144
144
|
buildInstance.vsrepocache.set(originalKey, (args, methodOptions) => {
|
|
145
|
-
if (
|
|
146
|
-
return args.at(
|
|
145
|
+
if (dynamicMethodInfo.prismaArgsIndex !== undefined)
|
|
146
|
+
return args.at(dynamicMethodInfo.prismaArgsIndex);
|
|
147
147
|
const resolveDbAndPrismaArgsData = {
|
|
148
148
|
instance: buildInstance,
|
|
149
149
|
options: methodOptions,
|
|
@@ -151,58 +151,58 @@ class VSRepository {
|
|
|
151
151
|
baseConfig: {
|
|
152
152
|
active: true,
|
|
153
153
|
defaultSelect: methods[originalKey]?.selectModel,
|
|
154
|
-
ignoreRequiredWhere:
|
|
154
|
+
ignoreRequiredWhere: dynamicMethodWhereOps.whereType === "overwrite",
|
|
155
155
|
},
|
|
156
|
-
withoutWhere:
|
|
156
|
+
withoutWhere: dynamicMethodInfo.ignoreWhere && !dynamicMethodInfo.onlyBaseWheres,
|
|
157
157
|
specificSelect: select,
|
|
158
|
-
pushWhere:
|
|
159
|
-
withoutSelect:
|
|
160
|
-
skipDuplicates:
|
|
161
|
-
|
|
162
|
-
? args.at(
|
|
163
|
-
:
|
|
164
|
-
pagination:
|
|
165
|
-
? args.at(
|
|
166
|
-
:
|
|
167
|
-
dataPayload:
|
|
168
|
-
? args.at(
|
|
158
|
+
pushWhere: dynamicMethodWhereOps.pushWhere,
|
|
159
|
+
withoutSelect: dynamicMethodInfo.ignoreSelect,
|
|
160
|
+
skipDuplicates: dynamicMethodCustomization.skipDuplicates,
|
|
161
|
+
ordering: dynamicMethodCustomization.orderPosition !== undefined
|
|
162
|
+
? args.at(dynamicMethodCustomization.orderPosition)
|
|
163
|
+
: dynamicMethodCustomization.injectOrdering,
|
|
164
|
+
pagination: dynamicMethodCustomization.paginationPosition !== undefined
|
|
165
|
+
? args.at(dynamicMethodCustomization.paginationPosition)
|
|
166
|
+
: dynamicMethodCustomization.injectPagination,
|
|
167
|
+
dataPayload: dynamicMethodInfo.dataIndex !== undefined
|
|
168
|
+
? args.at(dynamicMethodInfo.dataIndex)
|
|
169
169
|
: undefined,
|
|
170
|
-
createPayload:
|
|
171
|
-
? args.at(
|
|
170
|
+
createPayload: dynamicMethodInfo.createIndex !== undefined
|
|
171
|
+
? args.at(dynamicMethodInfo.createIndex)
|
|
172
172
|
: undefined,
|
|
173
|
-
updatePayload:
|
|
174
|
-
? args.at(
|
|
173
|
+
updatePayload: dynamicMethodInfo.updateIndex !== undefined
|
|
174
|
+
? args.at(dynamicMethodInfo.updateIndex)
|
|
175
175
|
: undefined,
|
|
176
|
-
|
|
177
|
-
distinctKeys:
|
|
176
|
+
withOrderingAndPagination: !dynamicMethodInfo.ignoreOrderByAndPagination,
|
|
177
|
+
distinctKeys: dynamicMethodCustomization.distinctKeys,
|
|
178
178
|
};
|
|
179
|
-
if (!
|
|
180
|
-
resolveDbAndPrismaArgsData.specificWhere = (0, specific_where_resolve_1.resolveSpecificWhere)(args,
|
|
179
|
+
if (!dynamicMethodInfo.ignoreWhere) {
|
|
180
|
+
resolveDbAndPrismaArgsData.specificWhere = (0, specific_where_resolve_1.resolveSpecificWhere)(args, dynamicMethodWhereOps.prettyWheres);
|
|
181
181
|
}
|
|
182
|
-
else if (
|
|
182
|
+
else if (dynamicMethodInfo.onlyBaseWheres) {
|
|
183
183
|
resolveDbAndPrismaArgsData.specificWhere =
|
|
184
|
-
|
|
185
|
-
? args.at(
|
|
184
|
+
dynamicMethodInfo.whereIndex !== undefined
|
|
185
|
+
? args.at(dynamicMethodInfo.whereIndex)
|
|
186
186
|
: {};
|
|
187
187
|
}
|
|
188
188
|
const { prismaArgs } = (0, dbAndPrismaArgs_resolve_1.resolveDbAndPrismaArgs)(resolveDbAndPrismaArgsData);
|
|
189
189
|
return prismaArgs;
|
|
190
190
|
});
|
|
191
191
|
if (showWorking) {
|
|
192
|
-
const argsSimulation = new Array(
|
|
192
|
+
const argsSimulation = new Array(dynamicMethodInfo.argsCount).fill("00");
|
|
193
193
|
const prismaArgs = buildInstance.vsrepocache.get(originalKey)(argsSimulation);
|
|
194
194
|
(0, logger_util_1.logger)(`PrismaArgs preview for ${methodToMap}:`, "build", buildInstance.tableName, prismaArgs);
|
|
195
195
|
}
|
|
196
196
|
buildInstance[originalKey] = async (...args) => {
|
|
197
197
|
let db = buildInstance.prisma;
|
|
198
198
|
let methodOptions = undefined;
|
|
199
|
-
if (args.length <
|
|
200
|
-
const missingParams =
|
|
201
|
-
.concat(
|
|
199
|
+
if (args.length < dynamicMethodInfo.argsCount) {
|
|
200
|
+
const missingParams = dynamicMethodInfo.whereParams
|
|
201
|
+
.concat(dynamicMethodInfo.otherParams)
|
|
202
202
|
.slice(args.length);
|
|
203
203
|
throw new vs_repo_error_1.VSRepoRuntimeError(`[VSRepository] (${buildInstance.tableName}: runtime) Missing parameters: ${missingParams.join(", ")}`, "48670");
|
|
204
204
|
}
|
|
205
|
-
else if (args.length >
|
|
205
|
+
else if (args.length > dynamicMethodInfo.argsCount) {
|
|
206
206
|
const optionsArg = args[args.length - 1];
|
|
207
207
|
methodOptions = (0, method_options_validate_1.validateMethodOptions)(optionsArg, buildInstance);
|
|
208
208
|
db = methodOptions.db ?? db;
|
|
@@ -212,20 +212,20 @@ class VSRepository {
|
|
|
212
212
|
}
|
|
213
213
|
const prismaArgs = buildInstance.vsrepocache.get(originalKey)(args, methodOptions);
|
|
214
214
|
const start = showWorking
|
|
215
|
-
? (0, logger_util_1.performanceLoggerStart)(buildInstance.tableName,
|
|
215
|
+
? (0, logger_util_1.performanceLoggerStart)(buildInstance.tableName, dynamicMethodInfo.method, prismaArgs)
|
|
216
216
|
: undefined;
|
|
217
217
|
try {
|
|
218
|
-
const result = await db[buildInstance.tableName][
|
|
218
|
+
const result = await db[buildInstance.tableName][dynamicMethodInfo.method](prismaArgs);
|
|
219
219
|
if (showWorking)
|
|
220
|
-
(0, logger_util_1.performanceLoggerEnd)(buildInstance.tableName,
|
|
221
|
-
if (
|
|
220
|
+
(0, logger_util_1.performanceLoggerEnd)(buildInstance.tableName, dynamicMethodInfo.method, start);
|
|
221
|
+
if (dynamicMethodInfo.existsMode) {
|
|
222
222
|
return !!result;
|
|
223
223
|
}
|
|
224
224
|
return result;
|
|
225
225
|
}
|
|
226
226
|
catch (err) {
|
|
227
227
|
// logger(
|
|
228
|
-
// `Fatal error when executing ${
|
|
228
|
+
// `Fatal error when executing ${dynamicMethodInfo.method}:`,
|
|
229
229
|
// "runtime",
|
|
230
230
|
// buildInstance.tableName,
|
|
231
231
|
// { prismaArgs },
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DynamicMethod = DynamicMethod;
|
|
4
|
-
const
|
|
4
|
+
const dynamic_methods_key_constant_1 = require("../constants/dynamic-methods-key.constant");
|
|
5
5
|
const dynamic_method_metadata_entity_1 = require("../entities/dynamic-method-metadata.entity");
|
|
6
6
|
const dynamic_method_config_validate_1 = require("../validation/dynamic-method-config.validate");
|
|
7
7
|
function DynamicMethod(config) {
|
|
8
8
|
const validatedConfig = config ? (0, dynamic_method_config_validate_1.validateDynamicMethodConfig)(config) : undefined;
|
|
9
9
|
return (target, propertyKey) => {
|
|
10
|
-
const methods = Reflect.getMetadata(
|
|
11
|
-
methods.push(new dynamic_method_metadata_entity_1.DynamicMethodMetadata(propertyKey, true, validatedConfig?.proxyTo, validatedConfig?.whereType, validatedConfig?.pushWhere, validatedConfig?.fbMode, validatedConfig?.
|
|
12
|
-
Reflect.defineMetadata(
|
|
10
|
+
const methods = Reflect.getMetadata(dynamic_methods_key_constant_1.DYNAMIC_METHODS_KEY, target) ?? [];
|
|
11
|
+
methods.push(new dynamic_method_metadata_entity_1.DynamicMethodMetadata(propertyKey, true, validatedConfig?.proxyTo, validatedConfig?.whereType, validatedConfig?.pushWhere, validatedConfig?.fbMode, validatedConfig?.injectOrdering, validatedConfig?.injectPagination));
|
|
12
|
+
Reflect.defineMetadata(dynamic_methods_key_constant_1.DYNAMIC_METHODS_KEY, methods, target);
|
|
13
13
|
};
|
|
14
14
|
}
|
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.QueryMethod = QueryMethod;
|
|
4
|
-
const
|
|
4
|
+
const dynamic_methods_key_constant_1 = require("../constants/dynamic-methods-key.constant");
|
|
5
5
|
const dynamic_method_metadata_entity_1 = require("../entities/dynamic-method-metadata.entity");
|
|
6
|
+
const vs_repo_error_1 = require("../errors/vs-repo.error");
|
|
6
7
|
const query_method_options_validate_1 = require("../validation/query-method-options.validate");
|
|
7
8
|
function QueryMethod(value, options) {
|
|
9
|
+
if (typeof value !== "string") {
|
|
10
|
+
throw new vs_repo_error_1.VSRepoDecoratorError(`[VSRepository] (unknown: decorator) 'value' must be a valid string`);
|
|
11
|
+
}
|
|
8
12
|
const validatedConfig = options
|
|
9
13
|
? (0, query_method_options_validate_1.validateQueryMethodOptions)(options)
|
|
10
14
|
: { modifying: false };
|
|
11
15
|
return (target, propertyKey) => {
|
|
12
|
-
const methods = Reflect.getMetadata(
|
|
16
|
+
const methods = Reflect.getMetadata(dynamic_methods_key_constant_1.DYNAMIC_METHODS_KEY, target) ?? [];
|
|
13
17
|
methods.push(new dynamic_method_metadata_entity_1.DynamicMethodMetadata(propertyKey, true, undefined, undefined, undefined, undefined, undefined, undefined, { value, ...validatedConfig }));
|
|
14
|
-
Reflect.defineMetadata(
|
|
18
|
+
Reflect.defineMetadata(dynamic_methods_key_constant_1.DYNAMIC_METHODS_KEY, methods, target);
|
|
15
19
|
};
|
|
16
20
|
}
|
|
@@ -8,17 +8,17 @@ class DynamicMethodMetadata {
|
|
|
8
8
|
whereType;
|
|
9
9
|
pushWhere;
|
|
10
10
|
fbMode;
|
|
11
|
-
|
|
11
|
+
injectOrdering;
|
|
12
12
|
injectPagination;
|
|
13
13
|
query;
|
|
14
|
-
constructor(propertyKey, map, proxyTo, whereType, pushWhere, fbMode,
|
|
14
|
+
constructor(propertyKey, map, proxyTo, whereType, pushWhere, fbMode, injectOrdering, injectPagination, query) {
|
|
15
15
|
this.propertyKey = propertyKey;
|
|
16
16
|
this.map = map;
|
|
17
17
|
this.proxyTo = proxyTo;
|
|
18
18
|
this.whereType = whereType;
|
|
19
19
|
this.pushWhere = pushWhere;
|
|
20
20
|
this.fbMode = fbMode;
|
|
21
|
-
this.
|
|
21
|
+
this.injectOrdering = injectOrdering;
|
|
22
22
|
this.injectPagination = injectPagination;
|
|
23
23
|
this.query = query;
|
|
24
24
|
}
|
|
@@ -91,8 +91,8 @@ function resolveBaseMethods(instance, config) {
|
|
|
91
91
|
baseConfig: baseMethods.getAll,
|
|
92
92
|
options: restOptions,
|
|
93
93
|
pagination,
|
|
94
|
-
|
|
95
|
-
|
|
94
|
+
ordering: order,
|
|
95
|
+
withOrderingAndPagination: true,
|
|
96
96
|
});
|
|
97
97
|
const start = showWorking
|
|
98
98
|
? (0, logger_util_1.performanceLoggerStart)(tableName, "getAll", prismaArgs)
|
|
@@ -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,
|
|
8
|
+
const { baseConfig, instance, options, wherePkValue, withoutSelect, withoutWhere, specificSelect, dataPayload, createPayload, updatePayload, alreadyValidatedOptions, specificWhere, pushWhere, ordering, pagination, skipDuplicates, forceSeeMode, withOrderingAndPagination, distinctKeys, } = data;
|
|
9
9
|
const validatedOptions = alreadyValidatedOptions && options
|
|
10
10
|
? options
|
|
11
11
|
: (0, method_options_validate_1.validateMethodOptions)(options, instance);
|
|
@@ -21,6 +21,9 @@ function resolveDbAndPrismaArgs(data) {
|
|
|
21
21
|
if (specificSelect) {
|
|
22
22
|
prismaArgs.select = specificSelect;
|
|
23
23
|
}
|
|
24
|
+
else if (validatedOptions.select) {
|
|
25
|
+
prismaArgs.select = validatedOptions.select;
|
|
26
|
+
}
|
|
24
27
|
else if (validatedOptions.includeModel) {
|
|
25
28
|
prismaArgs.include = instance.includeModels?.[validatedOptions.includeModel];
|
|
26
29
|
}
|
|
@@ -40,9 +43,9 @@ function resolveDbAndPrismaArgs(data) {
|
|
|
40
43
|
if (updatePayload) {
|
|
41
44
|
prismaArgs.update = updatePayload;
|
|
42
45
|
}
|
|
43
|
-
if (
|
|
44
|
-
if (instance.
|
|
45
|
-
prismaArgs.orderBy =
|
|
46
|
+
if (withOrderingAndPagination) {
|
|
47
|
+
if (instance.defaultOrdering || ordering) {
|
|
48
|
+
prismaArgs.orderBy = ordering ?? instance.defaultOrdering;
|
|
46
49
|
}
|
|
47
50
|
if (pagination) {
|
|
48
51
|
prismaArgs.skip = pagination.skip;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resolveDynamicMethodCustomization = resolveDynamicMethodCustomization;
|
|
4
|
+
const uncapitalize_util_1 = require("../utils/uncapitalize.util");
|
|
5
|
+
function resolveDynamicMethodCustomization(instance, dynamicMethodInfo, originalKey) {
|
|
6
|
+
const dynamicMethodCustomization = {};
|
|
7
|
+
if (!dynamicMethodInfo.ignoreSkipDuplicates) {
|
|
8
|
+
if (dynamicMethodInfo.keyToMapReplaced.endsWith("SkipDuplicates")) {
|
|
9
|
+
dynamicMethodInfo.keyToMapReplaced = dynamicMethodInfo.keyToMapReplaced.replace("SkipDuplicates", "");
|
|
10
|
+
dynamicMethodCustomization.skipDuplicates = true;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
if (!dynamicMethodInfo.ignoreOrderByAndPagination) {
|
|
14
|
+
dynamicMethodCustomization.injectOrdering =
|
|
15
|
+
instance.methods?.[originalKey]?.injectOrdering;
|
|
16
|
+
dynamicMethodCustomization.injectPagination =
|
|
17
|
+
instance.methods?.[originalKey]?.injectPagination;
|
|
18
|
+
if (dynamicMethodInfo.keyToMapReplaced.endsWith("PaginatedAndOrdered")) {
|
|
19
|
+
dynamicMethodCustomization.orderPosition = -2;
|
|
20
|
+
dynamicMethodCustomization.paginationPosition = -3;
|
|
21
|
+
dynamicMethodInfo.otherParams.push("pagination");
|
|
22
|
+
dynamicMethodInfo.otherParams.push("order");
|
|
23
|
+
dynamicMethodInfo.keyToMapReplaced = dynamicMethodInfo.keyToMapReplaced.replace("PaginatedAndOrdered", "");
|
|
24
|
+
dynamicMethodInfo.argsCount += 2;
|
|
25
|
+
}
|
|
26
|
+
else if (dynamicMethodInfo.keyToMapReplaced.endsWith("OrderedAndPaginated")) {
|
|
27
|
+
dynamicMethodCustomization.orderPosition = -3;
|
|
28
|
+
dynamicMethodCustomization.paginationPosition = -2;
|
|
29
|
+
dynamicMethodInfo.otherParams.push("order");
|
|
30
|
+
dynamicMethodInfo.otherParams.push("pagination");
|
|
31
|
+
dynamicMethodInfo.keyToMapReplaced = dynamicMethodInfo.keyToMapReplaced.replace("OrderedAndPaginated", "");
|
|
32
|
+
dynamicMethodInfo.argsCount += 2;
|
|
33
|
+
}
|
|
34
|
+
else if (dynamicMethodInfo.keyToMapReplaced.endsWith("Paginated")) {
|
|
35
|
+
dynamicMethodCustomization.paginationPosition = -2;
|
|
36
|
+
dynamicMethodInfo.otherParams.push("pagination");
|
|
37
|
+
dynamicMethodInfo.keyToMapReplaced = dynamicMethodInfo.keyToMapReplaced.replace("Paginated", "");
|
|
38
|
+
dynamicMethodInfo.argsCount++;
|
|
39
|
+
}
|
|
40
|
+
else if (dynamicMethodInfo.keyToMapReplaced.endsWith("Ordered")) {
|
|
41
|
+
dynamicMethodCustomization.orderPosition = -2;
|
|
42
|
+
dynamicMethodInfo.otherParams.push("order");
|
|
43
|
+
dynamicMethodInfo.keyToMapReplaced = dynamicMethodInfo.keyToMapReplaced.replace("Ordered", "");
|
|
44
|
+
dynamicMethodInfo.argsCount++;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
if (!dynamicMethodInfo.ignoreDistinct) {
|
|
48
|
+
const keySplitedDistinct = dynamicMethodInfo.keyToMapReplaced.split("Distinct");
|
|
49
|
+
if (keySplitedDistinct[1]) {
|
|
50
|
+
dynamicMethodCustomization.distinctKeys = keySplitedDistinct[1]
|
|
51
|
+
.split("And")
|
|
52
|
+
.map(uncapitalize_util_1.uncapitalize);
|
|
53
|
+
}
|
|
54
|
+
dynamicMethodInfo.keyToMapReplaced = keySplitedDistinct[0];
|
|
55
|
+
}
|
|
56
|
+
return dynamicMethodCustomization;
|
|
57
|
+
}
|